简体   繁体   English

从存储过程导出到Excel - SQL被阻止

[英]Export to Excel from stored procedure - SQL blocked

I have a stored procedure that I'm trying to export to excel. 我有一个存储过程,我试图导出到Excel。

insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=c:\sales.xls;;HDR=YES', 'SELECT * FROM [Sheet1$]') 
   exec des_z_test '19FDA2C7-E494-E411-80D2-0050568C3F74', 'E1AB4FD4-4C3B-E411-80D2-0050568C3F74'

However, I'm getting this error. 但是,我收到了这个错误。 The stored procedure runs fine on it's own. 存储过程可以自行运行。 I suspect the issue is from the insert statement 我怀疑问题来自insert语句

Msg 15281, Level 16, State 1, Line 1 Msg 15281,Level 16,State 1,Line 1
SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. SQL Server阻止访问组件“Ad Hoc Distributed Queries”的STATEMENT“OpenRowset / OpenDatasource”,因为此组件已作为此服务器的安全配置的一部分关闭。 A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. 系统管理员可以使用sp_configure启用“Ad Hoc Distributed Queries”。 For more information about enabling 'Ad Hoc Distributed Queries', search for 'Ad Hoc Distributed Queries' in SQL Server Books Online. 有关启用“Ad Hoc Distributed Queries”的详细信息,请在SQL Server联机丛书中搜索“Ad Hoc Distributed Queries”。

Any ideas? 有任何想法吗?

Zane在下面回答说:“听起来像是Integration Services的工作!”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM