想到两个方法:
1.把n个查询结果select 到一个临时表里,再统一导出到d:\test.txt
select * into table1 from t1 where ...
union all
select * from t2 where ...
union all
select * from t3 where ...
go
EXEC master..xp_cmdshell 'bcp temp..table1 out d:\test.txt -c -S"Servername" -U"sa" -P"sa"'
2.导成n个txt文件,在追加到一个里面
EXEC master..xp_cmdshell 'bcp temp..table1 out d:\test1.txt -c -S"Servername" -U"sa" -P"sa"'
EXEC master..xp_cmdshell 'bcp temp..table2 out d:\test2.txt -c -S"Servername" -U"sa" -P"sa"'