Search code examples
sql-serverexport-to-excel

Exporting data from SQL Server to Excel


i;m trying to automate the exporting of data from an sql server table to an excel using this script

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

but i;m getting an error:

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.


Solution

  • This blog article might help you.

    It sounds like you simply need to do:

    sp_configure 'Web Assistant Procedures', 1
    RECONFIGURE 
    

    And your script should work (as long as you have permissions on the SQL server)