34,588
社区成员
发帖
与我相关
我的任务
分享
EXEC master..xp_cmdshell 'bcp "select * from test" queryout c:\temp11.xls -c -q -S"localhost" -U"sa" -P"123456"'
[/quote]
就按这个大神这样来就行了。不过你要先开启xp_cmdshell这个组件。以下是开启的方法
EXEC sp_configure 'show advanced options', 1
RECONFIGURE
EXEC sp_configure 'xp_cmdshell', 1
RECONFIGUREEXEC master..xp_cmdshell 'bcp "select * from test" queryout c:\temp11.xls -c -q -S"localhost" -U"sa" -P"123456"'