Select In SQL Server-Cross Instance in same domain and different domain
Posted pealy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Select In SQL Server-Cross Instance in same domain and different domain相关的知识,希望对你有一定的参考价值。
Same Domain:
Exec sp_addlinkedserver ‘PC087‘:Add Remote Server
Exec sp_dropserver ‘InstcanceName‘:Delete Remote Server
sp_helpserver check already registed server at current
存储过程名/视图名 作用 举例
sp_addlinkedserver 注册远程数据库实例 exec sp_addlinkedserver ‘InstanceName’
sp_dropserver 删除远程数据库实例 exec sp_dropserver ‘InstanceName’
sp_addlinkedsrvlogin 注册远程实例登陆访问帐户 exec sp_addlinkedsrvlogin ‘InstanceName’, null
sp_droplinkedsrvlogin 删除远程实例登陆访问帐户 EXEC sp_droplinkedsrvlogin ‘InstanceName‘,‘UserName‘
sp_helpserver 当前实例已注册的可访问的实例(即查看使用sp_addlinkedserver已注册过的实例) sp_helpserver
sys.sysservers 功能同sp_helpserver select * from sys.sysservers
sys.linked_logins 查看已注册的登陆访问帐户(即查看使用sp_addlinkedsrvlogin已注册过的帐户) select * from sys.linked_logins
sys.remote_logins 查看已注册的远端访问帐户 select * from sys.remote_logins
Different Domain:
Use [Tracks]
UPDATE [Tracks].[dbo].Shipment SET [Tracks].[dbo].Shipment.IsPublic=tdss.[IsPublic]
FROM
(select * from opendatasource(‘SQLOLEDB‘ , ‘Data Source=IP Address; User ID=sa;Password=password‘).[LoadTestManagerUI].[dbo].[TripDetailForShipmentSearch])
as tdss
inner join [Tracks].[dbo].Shipment s ON tdss.ShipmentId=s.ShipmentId
以上是关于Select In SQL Server-Cross Instance in same domain and different domain的主要内容,如果未能解决你的问题,请参考以下文章
如何在 SQL (JPA) 中使用带有 IN 运算符的嵌套 SELECT 语句?