MSSQL 跨数据库连接

时间:2022-04-12 12:02:12

SELECT * FROM opendatasource('sqloledb','data source=192.168.1.197;user id=sa;password=sa')
.SafetyMonitor3.dbo.Dictionary

解决办法:  --启用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