1、開(kāi)始 —>
所有程序 —>
Microsoft SQL Server 2005 —>
配置工具 —>
SQL Server外圍應(yīng)用配置器 —>
功能的外圍應(yīng)用配置器 —>
實(shí)例名 —>
Database Engine —>
即席遠(yuǎn)程查詢 —>
啟用OpenRowset和OpenDatasource支持。
2.代碼啟用
啟用:
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
關(guān)閉:
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
在不啟用OpenRowset/OpenDatasource時(shí)使用如下語(yǔ)句:
INSERT INTO User_0502_tbl (BGQX ) SELECT ArID FROM OPENDATASOURCE ('Microsoft.Jet.OLEDB.4.0','Data source=''D:\delphi\Test\Database.mdb'';User ID=Admin;Password=')...AFiles_tbl 這個(gè)語(yǔ)句是從access導(dǎo)入數(shù)據(jù)到SQL2005數(shù)據(jù)表
你將看到“
SQL Server 阻止了對(duì)組件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatasource' 的訪問(wèn),因?yàn)榇私M件已作為此服務(wù)器安全配置的一部分而被關(guān)閉。系統(tǒng)管理員可以通過(guò)使用 sp_configure 啟用 'Ad Hoc Distributed Queries'。有關(guān)啟用 'Ad Hoc Distributed Queries' 的詳細(xì)信息,請(qǐng)參閱 SQL Server 聯(lián)機(jī)叢書中的 "外圍應(yīng)用配置器" ”錯(cuò)誤提升信息。