Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Simon_in_London
Starting Member
3 Posts |
Posted - 2012-12-26 : 17:15:13
|
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,SimonHumble SQL-Server bloke |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-12-26 : 23:30:37
|
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 MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|