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"‘