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

SQL2k - append row to csv file

Status
Not open for further replies.

MrPeds

Programmer
Jan 7, 2003
219
0
0
GB
Hi,

I'd like to know if there is a way of using a stored procedure to write the result of a query to a csv file.

My application code will create the csv file if it does not exist and i am assuming that suitable permissions will be available on the file for sql server.

What I would like to do is this:

If the file is empty, insert the columns returned in the query followed by the rows of the query result.

On subsequent calls to the stored procedure, simply append the result of the query to the csv file.

Thanks,

MrPeds
 
Peds,

If you're on SQL 2000, put the stored proc in a DTS package and create a csv connection as the output. This will append the file each time it runs.

HTH,

M.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top