查询将行从 sql server 复制到另一个 sql server [英] Query to copy rows from sql server to another sql server

查看:23
本文介绍了查询将行从 sql server 复制到另一个 sql server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个 sql server,SE1 和 SE2,它们基本上具有相同的架构,但每个都有自己的可用性.我需要找到一个查询来将一些行从 SE1.Table1 Where Destination Like '%HR%' 复制到 SE2.Table2.有这样的查询吗??提前谢谢.

I have two sql servers, SE1 and SE2, they are basically having the same schema, but each one has its own usability. I need to find a query to copy some rows from SE1.Table1 Where Destination Like '%HR%' to SE2.Table2. Is there such query ?? Thx in advance.

推荐答案

我发现最简单的方法是添加一个从一个到另一个的远程连接.因此,转到第二台服务器并执行以下操作:

I find the easiest way is to add a remote connection from one to the other. So, go to the second server and do:

sp_addlinkedserver SE1

然后您可以转到您要使用的数据库并执行以下操作:

Then you can go to the database you want to use and do something like:

insert into database.dbo.Table1(<column list>)
    select <column list>
    from SE1.database.dbo.Table1
    where col like '%HR%';

这使用四部分命名约定来访问删除表.

This uses the four-part naming convention to access the remove table.

这篇关于查询将行从 sql server 复制到另一个 sql server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆