sql生成excel

go
sp_configure 'show advanced options',1
reconfigure
go
sp_configure 'xp_cmdshell',1
reconfigure
go
EXEC master..xp_cmdshell 'bcp "SELECT * FROM TestDB.dbo.Test " queryout "c:\test.xls" -c -q -S. -U"sa" -P"go@1014903"'
GO
sp_configure 'xp_cmdshell',0
reconfigure

EXEC master..xp_cmdshell 'bcp "SELECT * FROM TestDB.dbo.Test " queryout "c:\test.xls" -c -q -S. -U"sa" -P"go@1014903"'

posted @ 2014-10-11 11:42  不要相信我  阅读(290)  评论(0编辑  收藏  举报