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

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

  

你可能感兴趣的:(数据库)