SQL Server 跨库连接

-- 开启组件
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure

-- 关闭组件
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
-- 查询远程数据库
SELECT *  FROM OPENDATASOURCE('SQLOLEDB','Data Source=192.168.7.137;User ID=sa;Password=8818522').PanelData.dbo.Channel

 

posted on 2016-06-03 12:04  Error503  阅读(360)  评论(0编辑  收藏  举报

导航