乏mily

导航

sql 跨域

1. 开通分布式查询权限

exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure

2. 查询

select * from openrowset('SQLOLEDB','192.168.1.6';'sa';'123',NETACS.dbo.tb_car) a
select * from opendatasource('SQLOLEDB','Data Source=192.168.1.6; User ID=sa; Password=123').NETACS.dbo.tb_car

3. 关闭

-- 注意执行顺序与 开通时 相反
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure

原文地址:http://www.veryhuo.com/a/view/16216.html

posted on 2016-03-07 09:05  乏mily  阅读(174)  评论(0编辑  收藏  举报