导出数据从SQL Server到Excel

导出数据从SQL Server到Excel

问题描述:

我; M试图自动使用这个脚本从SQL Server表到Excel数据的导出导出数据从SQL Server到Excel

EXEC sp_makewebtask 
    @outputfile = 'C:\testing.xls', 
    @query = 'Select * from HCIndonesia_20Jul2010..Combine_Final', 
    @colheaders =1, 
    @FixedFont=0,@lastupdated=0,@resultstitle='Testing details' 

但我; M得到一个错误:

Msg 15281, Level 16, State 1, Procedure xp_makewebtask, Line 1 SQL Server blocked access to procedure 'sys.xp_makewebtask' of component 'Web Assistant Procedures' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Web Assistant Procedures' by using sp_configure. For more information about enabling 'Web Assistant Procedures', see "Surface Area Configuration" in SQL Server Books Online.

blog article可能会帮助你。

这听起来像你只需要做到:

sp_configure 'Web Assistant Procedures', 1 
RECONFIGURE 

而且你的脚本应该工作(只要你有SQL服务器的权限)

+0

哼。现在我另一个问题: 消息17750,级别16,状态0,过程xp_makewebtask,行1 无法加载DLL xpweb90.dll或它引用的DLL之一。原因:126(找不到指定的模块)。 是否有一个.dll我必须得到? – marilyn 2010-07-22 07:45:03

+2

@marilyn - 看起来这个错误是由于试图在SQL Express上运行这个SP导致的 - 这个存储过程(根据Google)已被弃用,所以您应该考虑另一种方法来做到这一点。 – Justin 2010-07-22 07:53:40

+0

我想你是对的。谢谢。 :) – marilyn 2010-07-22 08:16:43