--在执行跨服务器查询之前,运行
exec sp_configure ‘show advanced options‘,1
reconfigure
exec sp_configure ‘Ad Hoc Distributed Queries‘,1
reconfigure
insert into OPENDATASOURCE(
‘SQLOLEDB‘,
‘Data Source=地址;User ID=用户;Password=密码‘
).数据库名.dbo.表名
select * from 本地表名
--查询结束后,运行
exec sp_configure ‘Ad Hoc Distributed Queries‘,0
reconfigure
exec sp_configure ‘show advanced options‘,0
reconfigure
原文地址:https://www.cnblogs.com/vsnb/p/11597035.html
时间: 2024-10-05 05:50:11