连接远程数据库,得到数据插入本地表中

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

INSERT INTO userinfo
Select a.*
FROM OPENROWSET('SQLOLEDB','172.18.9.157';'sa';'sa',
   'Select * FROM [test].dbo.userinfo') AS a
   
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure

  

posted @ 2013-07-08 09:53  chenping2008  阅读(1168)  评论(0编辑  收藏  举报