第一步:
启用Ad Hoc Distributed Queries语句:
exec sp_configure ‘show advanced options‘,1
reconfigure
exec sp_configure ‘Ad Hoc Distributed Queries‘,1
reconfigure
附关闭Ad Hoc Distributed Queries语句:
exec sp_configure ‘Ad Hoc Distributed Queries‘,0
reconfigure
exec sp_configure ‘show advanced options‘,0
reconfigure
第二步:
SELECT * FROM OPENDATASOURCE(
‘SQLOLEDB‘,
‘Data Source=.;User ID=sa;Password=sa‘).数据库名.dbo.表名
时间: 2024-10-09 23:02:32