Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting query results to CSV file

Status
Not open for further replies.

developer155

Programmer
Joined
Jan 21, 2004
Messages
512
Location
US
Can someone explain to me please how to export a query that I am running on SQL Query Analyzer to comma delimeterd file such as csv file. The query is something like select @vsriablename, @variable2name...

I need the results to go to csv file

thanks!!!
 
Hi

Select the menu "Tools" "Options" and the "Results" tab.

Choose "Results to File..." in the Default results target.
Choose "Comma Delimited (CSV)" in the Results output format.

Then run the query and it will prompt you for a file name.

Hope this helps.

Mark
 
Mark, this is great, but I have yet another question. What if I ahve a stored procedure and it selects results from some tables and I want those results to be exported to csv. Is there any way to code it in sp, since it is going to be a job that runs on the server

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top