从存储过程导出到 Excel - SQL 已阻止
Export to Excel from stored procedure - SQL blocked
我有一个要导出到 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'
但是,我遇到了这个错误。存储过程本身运行良好。我怀疑问题出在插入语句
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. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', search for 'Ad Hoc Distributed Queries' in SQL Server Books Online.
有什么想法吗?
赞恩在下面回答,"Sounds like a job for Integration Services!"
我有一个要导出到 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'
但是,我遇到了这个错误。存储过程本身运行良好。我怀疑问题出在插入语句
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. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', search for 'Ad Hoc Distributed Queries' in SQL Server Books Online.
有什么想法吗?
赞恩在下面回答,"Sounds like a job for Integration Services!"