Friday, March 9, 2012

Programmatically creating .csv file

Hi there,

I got a user who is requesting a weekly report to be exported in csv (comma delimited) format. But this process will run weekly using schedule job and he wants the file to save to a certain directory on the network. Two part questions...

1. Is there a way to create a .csv file programmatically after runing the query?

2. How would I save the .csv file to a specified directory on the network?

TIA

You can use the BulkCopy (bcp) command-line utility to do this. You can schedule a job using SQLAgent that can run it periodically. See Books Online for more details on the utility and options.

No comments:

Post a Comment