在两个server都须要启用Ad Hoc Distributed Queries:
EXEC sp_configure ‘show advanced options‘, 1
RECONFIGURE
EXEC sp_configure ‘Ad Hoc Distributed Queries‘, 1
RECONFIGURE
然后就能够使用SQL内置函数訪问:
SELECT *
FROM OPENDATASOURCE(‘SQLOLEDB‘,
‘Data Source=111.111.113.41;User ID=sa;Password=‘).ycfyhis.dbo.dictdept
时间: 2024-10-10 18:02:02