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

上一篇:Masonry适配的简单使用


下一篇:[BUAA2021软工]结对第一阶段博客作业小结