Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Exporting data in a complex way - please help!
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

United Kingdom
3 Posts

Posted - 12/26/2012 :  17:15:13  Show Profile  Reply with Quote
Hi there (and happy 2013/Christmas/Hanukkah/Diwali),

I've got to create some CSV files of generic data (e.g. product name, type etc. sold in the previous week) but it's too difficult for me and I would really appreciate your individual/collective wisdom.

It is a CSV file but I also need its first record to be a header file which will be pipe-delimited. Is that actually possible?

And this header file will have very different contents to the rest of file (i.e. 3 columns rather than the expected 5, as there were 5 columns in the data section).

This header record needs to state the (1) Name of the file, (2) The date of extraction in "dd/mm/yyyy" format, (3) the number of records in the data section (i.e. this file excluding this header row).

And somehow this CSV's filename has to be in the format where the last 8 characters (preceding the ".csv" extension) are the date in this format "ddmmyy".

I hope it was clear enough, please help.

Many thanks,


Humble SQL-Server bloke

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 12/26/2012 :  23:30:37  Show Profile  Reply with Quote
you need to do it in two steps. first creating header information and then detail and then append onto main file. The date can be extracted using Now() function, the number of records can be obtained by using a rowcount transform. the dynamic name can be generated using expression builder by confirguring connection string property.

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000