What you are looking for are Linked Servers.
(您正在寻找的是链接服务器。)
You can get to them in SSMS from the following location in the tree of the Object Explorer: (您可以从“对象资源管理器”树中以下位置的SSMS中找到它们:)
Server Objects-->Linked Servers
or you can use sp_addlinkedserver .
(或者您可以使用sp_addlinkedserver 。)
You only have to set up one.
(您只需要设置一个。)
Once you have that, you can call a table on the other server like so: (一旦有了它,就可以像这样在另一台服务器上调用一个表:)
select
*
from
LocalTable,
[OtherServerName].[OtherDB].[dbo].[OtherTable]
Note that the owner isn't always dbo
, so make sure to replace it with whatever schema you use.
(请注意,所有者并不总是dbo
,因此请确保将其替换为您使用的任何架构。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…