将数据从SQL Server导出到Excel [英] Exporting data from SQL Server to Excel

查看:106
本文介绍了将数据从SQL Server导出到Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

i; m正在尝试使用此脚本自动将数据从sql server表导出到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'

但是我遇到错误:

消息15281,级别16,状态1,过程xp_makewebtask,第1行 SQL Server禁止访问组件"Web Assistant Procedures"的过程"sys.xp_makewebtask",因为作为该服务器安全配置的一部分,此组件已关闭.系统管理员可以使用sp_configure启用"Web Assistant过程"的使用.有关启用"Web Assistant过程"的更多信息,请参见SQL Server联机丛书中的曲面区域配置".

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.

推荐答案

This blog article might help you.

听起来您只需要做:

sp_configure 'Web Assistant Procedures', 1
RECONFIGURE 

并且您的脚本应该可以正常工作(只要您对SQL Server拥有权限)

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

这篇关于将数据从SQL Server导出到Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆