SQL SERVER 执行远端数据库的SQL命令

mac2022-06-30  70

--------------------------------------------------------------这段先执行exec sp_configure 'show advanced options',1 reconfigure exec sp_configure 'Ad Hoc Distributed Queries',1 reconfigure------------------------------------------------------------

 

 

--这里写要执行的SQL语句select * from opendatasource('SQLOLEDB','server={server};uid={uid};pwd={pwd}').[DataBaseName].dbo.TableName

 

 

--------------------------------------------------------------语句运行完以后执行这段关闭配置exec sp_configure 'Ad Hoc Distributed Queries',0 reconfigure exec sp_configure 'show advanced options',0 reconfigure------------------------------------------------------------

转载于:https://www.cnblogs.com/xiebin1986/p/3818634.html

最新回复(0)