码迷,mamicode.com
首页 > 数据库 > 详细

SQL 系统表应用

时间:2018-05-21 19:40:05      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:系统表   als   应用   name   out   outer   local   links   ipa   

查看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

SQL 系统表应用

标签:系统表   als   应用   name   out   outer   local   links   ipa   

原文地址:https://www.cnblogs.com/hellohongfu/p/9068612.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!