KingAmu'Code

BCP将数据导出excel

EXEC master..xp_cmdshell 'bcp "SELECT id,dwell FROM DB_Name.dbo.t_text" queryout D:\F.txt -w -T -S"192.168.1.2" -U"sa" -P""'

如果提示xp_cmdshell的话,要先开通

开启:EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;

关闭:EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 0;

 

posted on 2010-03-23 11:31  阿牧  阅读(242)  评论(0编辑  收藏  举报

导航