码迷,mamicode.com
首页 > 数据库 > 详细

跨服务器、跨库操作SQL

时间:2019-09-27 12:27:05      阅读:117      评论:0      收藏:0      [点我收藏+]

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

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

原文地址:https://www.cnblogs.com/vsnb/p/11597035.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!