SqlServer 跨服务器查询
生活随笔
收集整理的這篇文章主要介紹了
SqlServer 跨服务器查询
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
服務器A,服務器B
select * from(
?? select a.ID as Hid,a.subjectid as Hsubjectid,b.ID as Lid,b.subjectid as Lsubjectid,c.* FROM OPENROWSET('MSDASQL',
?? 'DRIVER={SQL Server};SERVER=A;UID=sa;PWD=***',
?? dbName) as a? left join OPENROWSET('MSDASQL',
?? 'DRIVER={SQL Server};SERVER=B;UID=sa;PWD=***',
?? dbName) as b? on a.subjectid = b.subjectid ?
?? left join OPENROWSET('MSDASQL',
?? 'DRIVER={SQL Server};SERVER=B;UID=sa;PWD=***',
?? dbName) as c
?? on c.CourseID = a.ID where a.subjectid = b.subjectid and c.CourseID = a.ID) as T?
轉載于:https://www.cnblogs.com/shiyige-216/p/5648767.html
總結
以上是生活随笔為你收集整理的SqlServer 跨服务器查询的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: window系统查看端口被哪个进程占用了
- 下一篇: epoll 的accept , read