To execute a query and output the result to a file.
execute master..xp_cmdshell 'bcp "select top 1 * from pubs..authors" queryout "c:\authors.TXT" -T -c -r -t'
转载于:https://www.cnblogs.com/jerryhong/archive/2007/06/01/767890.html
转载于:https://www.cnblogs.com/jerryhong/archive/2007/06/01/767890.html