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

Creating a file from query result set

Status
Not open for further replies.

darwin101

Programmer
Mar 7, 2001
156
US
Hi all

Could someone point me to a source to learn how to create a file out of a result set. I would like to automate a query and have it create the file without my intervention.

thanks.
 
Since you did not specify what type of file you want to create, I won't attempt to guess.

I have a procedure written that outputs the resultset to an XL worksheet. The procedure runs from XL. I will post it for you if this is what you want.

Franco
 
For example, the command to bulk copy the publishers table in the pubs database to the Publ.txt file using Unicode character format is:

bcp pubs..publishers out publ.txt -w -Sservername -Usa -Ppassword


The life is too short to cry and long enough to try it... God bless us.
[thumbsup2]
 
Sorry about that, I need to create a .txt file, tab separated, and place it in a specific location. Now I am doing it by hand in QA.

thanks
 
Hi Vedicman,

I am interested in the stored proc that you have mentioned. I need to create a scheduled job that calls a proc that dumps a result set into a .txt or .csv or excel workbook file in a user specifiable location. As an absolute bonus extra, i'd like to be able to append -getdate() to the file name so i don't get any conflicts (hence why I'm trying to do it in SQL - to use the date time functionality). Would you either be kind enough to post the proc for me, or I'll create a hotmail address that you can send it to if you'd like to keep anon.

thanks in advance

Skiboy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top