SQL跨库查询语句

select top 1 a.PersonName,isnull(a.PhoneNumber,0) PhoneNumber,a.AreaID,a.AreaName,b.CustomerName
from OPENDATASOURCE('SQLOLEDB','Data Source=192.168.0.243;User ID=sa;Password=wecome@159357').WKOMS.dbo.PubAreAssist a
left join OPENDATASOURCE('SQLOLEDB','Data Source=192.168.0.243;User ID=sa;Password=wecome@159357').WKOMS.dbo.Customer b
on a.AreaID=B.AreaID where b.Code='HN07.0159' and a.org='1001609280000268'

posted @ 2020-05-06 16:21  咖啡无眠  阅读(927)  评论(0编辑  收藏  举报