日期:2014-05-16 浏览次数:20515 次
EXEC master..xp_cmdshell 'bcp dbname..tablename out c:\DT.txt -c -Sservername -Usa -Ppassword'
或
EXEC master..xp_cmdshell 'bcp "Select * from dbname..tablename" queryout c:\DT.txt -c -Sservername -Usa -Ppassword'
exec master..xp_cmdshell 'bcp "select ''Cust_nbr'' Cust_nbr,''Acc_nbr'' Acc_nbr union all select Cust_nbr,Acc_nbr from [数据库名].dbo.pz14_yd" queryout [txt文件名] -S "[服务器名]" -U "[账号]" -P "[密码]" -c -t "," '