另类Sql语句直接导出表数据到Execl

/* 
设置sql权限导出Execl
 EXEC sp_configure N'show advanced options', N'1' 
 RECONFIGURE WITH OVERRIDE
 EXEC sp_configure N'xp_cmdshell', N'1'
 RECONFIGURE WITH OVERRIDE 
 EXEC sp_configure N'show advanced options', N'0' 
 RECONFIGURE WITH OVERRIDE
*/

EXEC master..xp_cmdshell 'bcp AiFuMu_DB.dbo.AFM_ProductOutput out "c:\test.xls" -c -S"127.0.0.1" -U"sa" -P"123456"'  

posted @ 2012-08-23 15:22  深南大道  阅读(171)  评论(0)    收藏  举报