DBMNG数据库管理与应用

独立思考能力,对于从事科学研究或其他任何工作,都是十分必要的。
当前位置:首页 > SQLServer > 常见问题

SQLServer阻止了对组件'AdHocDistributedQueries'的STATEMENT'OpenRowset/OpenDatasource'的访问

原因:在从远程服务器复制数据到本地时出现“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:

1
2
3
4
exec sp_configure'show advanced options',1 
reconfigure 
exec sp_configure'Ad Hoc Distributed Queries',1 
reconfigure 

使用完成后,关闭Ad Hoc Distributed Queries:

1
2
3
4
exec sp_configure'Ad Hoc Distributed Queries',0 
reconfigure 
exec sp_configure'show advanced options',0 
reconfigure 

Sql 语句

1
select *into tableBfrom OPENDATASOURCE('SQLOLEDB','Data Source=192.168.0.235;User ID=sa;Password=asasas').库名.dbo.表名 


不知道所描述是否有欠缺,欢迎补充!!

本站文章内容,部分来自于互联网,若侵犯了您的权益,请致邮件chuanghui423#sohu.com(请将#换为@)联系,我们会尽快核实后删除。
Copyright © 2006-2023 DBMNG.COM All Rights Reserved. Powered by DEVSOARTECH            豫ICP备11002312号-2

豫公网安备 41010502002439号