时间:2021-07-01 10:21:17 帮助过:2人阅读
启用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.表名
SQL语句实现跨数据库访问
标签: