[dba-SQLServer] export query results to csv with dynamic header and footer rows

David Lewis David at sierranevada.com
Fri May 2 12:46:56 CDT 2008


Hi everyone:
I have to create a csv for a weekly ftp upload.  I have gotten to where I can use xp command shell and bcp to create the file using a view (no problems there).
However I need to add three header rows and four footer rows with the following info:

Headers
Filename (will not change)
File type (will not change)
Create date (obviously changes)

Footers
Filename (will not change)
File type (will not change)
Create date (obviously changes)
Total Rows      (ditto)

I can find nothing on the web that indicates how I might do this within sql server.  I could open the file manually and add them, or perhaps write a vb app that does that, but for obvious reasons I would rather not.  Anyone have any experience with this?  Many thanks. D. Lewis

The contents of this e-mail message and its attachments are covered by the Electronic Communications Privacy Act (18 U.S.C. 2510-2521) and are intended solely for the addressee(s) hereof. If you are not the named recipient, or the employee or agent responsible for delivering the message to the intended recipient, or if this message has been addressed to you in error, you are directed not to read, disclose, reproduce, distribute, disseminate or otherwise use this transmission.  If you have received this communication in error, please notify us immediately by return e-mail or by telephone, 530-893-3520, and delete and/or destroy all copies of the message immediately.




More information about the dba-SQLServer mailing list