当前位置: 代码迷 >> 综合 >> SQL Sever的OPENDATASOURCE (Transact-SQL)相关问题
  详细解决方案

SQL Sever的OPENDATASOURCE (Transact-SQL)相关问题

热度:57   发布时间:2024-01-06 07:51:58.0

在存储过程中添加进行非链接服务器的远程调用时,SSMS弹出错误提示【SQL Server 阻止了对组件“Ad Hoc Distributed Queries”的 STATEMENT“OpenRowset/OpenDatasource”的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用“Ad Hoc Distributed Queries”。】

解决方法:

新建查询 :开启Ad Hoc Distributed Queries组件

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

事后也可以关闭组件,在查询中:

exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure

若是弹出提示 “请输入RECONFIGURE来执行” ,忽略即可

  相关解决方案