How to enable Ad Hoc Distributed Queries

前端 未结 4 1797
谎友^
谎友^ 2020-11-29 17:44

When I run a query with OPENROWSET in SQL Server 2000 it works.

But the same query in SQL Server 2008 generates the following error:

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 18:19

    You may check the following command

    sp_configure 'show advanced options', 1;
    RECONFIGURE;
    GO  --Added        
    sp_configure 'Ad Hoc Distributed Queries', 1;
    RECONFIGURE;
    GO
    
    SELECT a.*
    FROM OPENROWSET('SQLNCLI', 'Server=Seattle1;Trusted_Connection=yes;',
         'SELECT GroupName, Name, DepartmentID
          FROM AdventureWorks2012.HumanResources.Department
          ORDER BY GroupName, Name') AS a;
    GO
    

    Or this documentation link

提交回复
热议问题