--开启本服务器中操作其他服务器的功能 exec sp_configure ‘show advanced options‘,1 reconfigure --输出消息 exec sp_configure ‘Ad Hoc Distributed Queries‘,1 reconfigure --输出消息 --增 INSERT INTO OPENROWSET(‘SQLOLEDB‘,‘jx3xxiednr3ucidf‘;‘sa‘;‘Aa12345‘,yyg.dbo.T_Tabel_a) ([Name])VALUES(‘张慧‘) --删 DELETE OPENROWSET(‘SQLOLEDB‘,‘jx3xxiednr3ucidf‘;‘sa‘;‘Aa12345‘,yyg.dbo.T_Tabel_a) WHERE [Name] = ‘张慧‘ --改 UPDATE OPENROWSET(‘SQLOLEDB‘,‘jx3xxiednr3ucidf‘;‘sa‘;‘Aa12345‘,yyg.dbo.T_Tabel_a) SET [Name] = ‘陈秋水‘ WHERE Id = 4 --查 SELECT * FROM OPENROWSET(‘SQLOLEDB‘,‘jx3xxiednr3ucidf‘;‘sa‘;‘Aa12345‘,yyg.dbo.T_Tabel_a) --关闭本服务器中操作其他服务器的功能 exec sp_configure ‘Ad Hoc Distributed Queries‘,0 reconfigure -- 输出消息 exec sp_configure ‘show advanced options‘,0 reconfigure --输出消息 --说明:SELECT * FROM OPENROWSET(‘SQLOLEDB‘,‘服务器‘;‘账户(数据库账户)‘;‘密码(数据库密码)‘,yyg.dbo.T_Tabel_a)
时间: 2024-10-08 01:26:12