各位老大:
我在用bcp从数据库中提取数据时如果整表提取,用下面语句
exec master..xp_cmdshell bcp "mdinfo..student" out e:\user\aaa.txt -c -q -S"dataserver" -U"sa" -P"me" 速度很快提取全部数据
但是如果用下面语句
exec master..xp_cmdshell bcp "select student_id,student_name from mdinfo..student" queryout e:\user\aaa.txt -c -q -S"dataserver" -U"sa" -P"me" 则速度很慢,请教各位是什么原因,需要如何修改
好象只能这样
好像第2种用了中间处理,所以慢
select student_id,student_name into ##temp from mdinfo..student
exec master..xp_cmdshell bcp "tempdb..##temp" out e:\user\aaa.txt -c -q -S"dataserver" -U"sa" -P"me"
打错了,小改一下:
drop table tempdb..##temp
^_^