SQL 系统表应用
查看link server
select DD.System,DD.DB,DD.previous_processing_dte, DD.processing_dte,LS.LinkServerName,LS.DBServer,ServerList.ServerName from DD
INNER JOIN
(
SELECT a.name as LinkServerName,data_source as DBServer
FROM sys.Servers a
LEFT OUTER JOIN sys.linked_logins b ON b.server_id = a.server_id
LEFT OUTER JOIN sys.server_principals c ON c.principal_id = b.local_principal_id
) LS
on DD.LinkServerName = LS.LinkServerName
LEFT JOIN
(
select ServerName,HostName + ',' + SQLPort as DBServer from conf.DBServerList
union
select ServerName,'.,1443from conf.DBServerList
where HostName = @@SERVERNAME
) ServerList
on LS.DBServer = ServerList.DBServer
posted on 2018-05-21 18:15 HelloHongfu 阅读(132) 评论(0) 编辑 收藏 举报