SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

Simon_in_London
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,

Simon


Humble SQL-Server bloke

visakh16
Very Important crosS Applying yaK Herder

India
52325 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
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.06 seconds. Powered By: Snitz Forums 2000