当前位置:Gxlcms > 数据库问题 > 跨服务器、跨库操作SQL

跨服务器、跨库操作SQL

时间:2021-07-01 10:21:17 帮助过:31人阅读

--在执行跨服务器查询之前,运行
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

跨服务器、跨库操作SQL

标签:led   操作   pen   oledb   word   user   ons   end   open   

人气教程排行