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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export results to file

Status
Not open for further replies.

BFT1303

Programmer
Jan 26, 2007
29
US
I am trying to export the results of my stored procedure to a file(.csv or .xls).

I am not sure how to accomplish this. Any help or pointers would be greatly appreciated.

Thanks,
Brad
 
I am not sure whether it is the way to do it, but you may try this, it worked for me.


In query analyzer,


* In Query Menu, select Results to File , also by pressing Ctrl+Shift+F
* In Tools -> Options menu, Results tab, clear flag for "Print column
headers(*)"


Execute your sp now, file save dialog will open where you save the file with
.xls extension.


Assuming your SP return result set, this method should work. While opening
file in EXCEL you may get some formatting question for EXCEL to format it
correctly.


I hope this helps you.


Thanks,
 
BFT1303, to do this in an automated approach, you'll have to use Integration Services, which is how SQL wants you to move data from one type of repository to another.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top