exec sp_configure 'show advanced options',1 --开起
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
Go
SELECT distinct([GoodsCode]) FROM OPENROWSET('SQLOLEDB','192.168.8.88';'sa';'123456',[Test].[dbo].[Customs])
exec sp_configure 'Ad Hoc Distributed Queries',0 --关闭
reconfigure
exec sp_configure 'show advanced options',0
reconfigure