sql跨数据库查询方法

http://www.cnblogs.com/xingluzhe/archive/2012/02/01/2334311.html

SELECT u_name  
  FROM OPENROWSET('sqloledb','DRIVER={SQL Server};SERVER=119.48.48.152;UID=y_ydgl;PWD=55555////\',DB.dbo.y_users)  where u_name='1'
  UNION   all
SELECT u_name  
  FROM OPENROWSET('sqloledb','DRIVER={SQL Server};SERVER=119.48.48.152;UID=y_ydgl;PWD=55555////\',DB1.dbo.y_users)  where u_name='1'

posted on 2015-05-01 07:59  那里的天空  阅读(607)  评论(0编辑  收藏  举报

导航