鏈接遠程數據庫,獲得數據插入本地表中

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
相關文章
相關標籤/搜索