27,579
社区成员
发帖
与我相关
我的任务
分享
--参考...
--先开启cmdshell
EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
EXEC sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE
GO
/**根据sql语句导出指定表的文本文件 */
EXEC master..xp_cmdshell 'bcp "select top 10 * from dbname..tablename" queryout d:\DT.xls -c -Sservername -Usa -Ppassword'