How to enable Ad Hoc Distributed Queries

前端 未结 4 1763
谎友^
谎友^ 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:16

    The following command may help you..

    EXEC sp_configure 'show advanced options', 1
    RECONFIGURE
    GO
    EXEC sp_configure 'ad hoc distributed queries', 1
    RECONFIGURE
    GO
    
    0 讨论(0)
  • 2020-11-29 18:17
    sp_configure 'show advanced options', 1;
    GO
    RECONFIGURE;
    GO
    sp_configure 'Ad Hoc Distributed Queries', 1;
    GO
    RECONFIGURE;
    GO
    
    0 讨论(0)
  • 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

    0 讨论(0)
  • 2020-11-29 18:24

    If ad hoc updates to system catalog is "not supported", or if you get a "Msg 5808" then you will need to configure with override like this:

    EXEC sp_configure 'show advanced options', 1
    RECONFIGURE with override
    GO
    EXEC sp_configure 'ad hoc distributed queries', 1
    RECONFIGURE with override
    GO
    
    0 讨论(0)
提交回复
热议问题