两个sqlserver数据库在不同的服务器上如何插入数据哪?
1 EXEC sp_configure 'show advanced options', 1 2 RECONFIGURE 3 EXEC sp_configure 'Ad Hoc Distributed Queries', 1 4 RECONFIGURE 5 6 INSERT INTO [a].[dbo].[at] 7 ([at1] 8 ,[at2] 9 ,[at3]) 10 SELECT [bt1] 11 ,[bt2] 12 ,[bt3] 13 FROM OPENROWSET('SQLNCLI','Server=ip;PWD=pwd;UID=uid;DataBase=db','SELECT [bt1], [bt2], [bt3], [bt4] FROM [bt]') AS b 14 WHERE [bt3] = 1 AND bt4 < GETDATE() 15 AND NOT EXISTS (SELECT 1 FROM [a].[dbo].[at] a WHERE a.at1 = b.bt1 ) 16 ORDER BY [at1] ASC 17 18 EXEC sp_configure 'Ad Hoc Distributed Queries',0 19 RECONFIGURE 20 EXEC sp_configure 'show advanced options',0 21 RECONFIGURE