解決SQL Server 阻止了對組件 'Ad Hoc Distributed Queries' 的 STATEMENT 'OpenRowset/OpenDatasource' 的訪問
阿新 • • 發佈:2017-06-13
option eight img 導入 col cnblogs 數據 編輯器 code
根據需要進行asp.net的數據導入導出,結果報以下錯:
SQL Server 阻止了對組件 ‘Ad Hoc Distributed Queries‘ 的 STATEMENT ‘OpenRowset/OpenDatasource‘ 的訪問,因為此組件已作為此服務器安全配置的一部分而被關閉。系統管理員可以通過使用 sp_configure 啟用 ‘Ad Hoc Distributed Queries‘。有關啟用 ‘Ad Hoc Distributed Queries‘ 的詳細信息,請參閱 SQL Server 聯機叢書中的 "外圍應用配置器"。
開啟Ad Hoc Distributed Queries組件,在sql查詢編輯器中執行如下語句:
1 --配置權限 2 EXEC sp_configure ‘show advanced options‘, 1; 3 GO 4 RECONFIGURE; 5 GO 6 EXEC sp_configure ‘Ad Hoc Distributed Queries‘, 1; 7 GO 8 RECONFIGURE; 9 GO
執行結果:
關閉Ad Hoc Distributed Queries組件,在sql查詢編輯器中執行如下語句:
1 exec sp_configure ‘Ad Hoc Distributed Queries‘,0; 2 go 3 reconfigure; 4 go 5 exec sp_configure ‘show advanced options‘,0; 6 go 7 reconfigure; 8 go
解決SQL Server 阻止了對組件 'Ad Hoc Distributed Queries' 的 STATEMENT 'OpenRowset/OpenDatasource' 的訪問