Click here to Skip to main content
15,888,085 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello community

I need to know, how can I export all results from a select of a procedure store to text file.


To simplify the idea of my question, here is a step diagram:

1. Execute SP , 2. bring the data from table y make the data process ->; 3. show results...after step 3, must be the results exportation to text file

the sql server that I use is sql 2000 but is someone know by another version doesn't matter.

If my question is poor on information, please let me know

Thanks a lot</pre>
Posted
Comments
DamithSL 29-Jun-14 0:18am    
where you run this SP? are you using sql server management studio?

Take a look at the gsqlcmd[^] command line utility.

For example, you may export data as text, csv, or htm:
gsqlcmd sql "EXEC dbo.sp_MyProcedure" output.txt

gsqlcmd sql "EXEC dbo.sp_MyProcedure" output.csv

gsqlcmd sql "EXEC dbo.sp_MyProcedure" output.htm

where sql is a name of the target connection.
 
Share this answer
 
Comments
Salomon Pineda Silva 24-Jul-14 18:04pm    
thanks very much! :)
 
Share this answer
 
Comments
Salomon Pineda Silva 29-Jul-14 11:24am    
thank you very much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900