sqlserver2005开启xp_cmdShell
EXEC sp_configure 'show advanced options', 1; RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;
exec master..xp_cmdshell 'bcp "SELECT * FROM emergency.dbo.log" queryout c:\bb.xls -c -S"wzp" -U"sa" -P"sa" '
![](http://www.cnblogs.com/images/cnblogs_com/nanshouyong326/90398/o_20080126(020).jpg)
EXEC sp_configure 'show advanced options', 1; RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;
exec master..xp_cmdshell 'bcp "SELECT * FROM emergency.dbo.log" queryout c:\bb.xls -c -S"wzp" -U"sa" -P"sa" '