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.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 SSIS: Add footer row to existing flat file

Author  Topic 

kissa49
Starting Member

10 Posts

Posted - 2009-12-11 : 14:42:29
Hi,
I am trying to add a footer row at the bottom of a txt file that already contains data in it.
If I write to that file in a data flow from OLE DB Source, using that file as the "Flat File Destination" and not overwriting it, a whole row is created with semicolons, because that file is semicolon delimited and needs to stay that way.
Any input on this is appreciated as I am breaking my head trying everything and nothing works.
THANK YOU! :)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-11 : 14:56:37
I'm not sure if there is a better way, but I'd put your footer into a new file and then concatenate your delimited file with this new file via a type command: type *.extension > c:\somenewconcatfile.txt

The concatenating via type command is done alphabetically, so name your files appropriately.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-12-11 : 14:59:50
One way is to create a separate flat file connection manager for the footer row alone (without any delimiters of course). And then write to the same file from OLE DB source without overwriting
Go to Top of Page

kissa49
Starting Member

10 Posts

Posted - 2009-12-11 : 15:53:17
Tara, is type a function in SQL2005? Can't find anything on it. Never heard of it before.
Thanks!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-11 : 17:07:10
It's a DOS command, so you'd run it from a cmdexec task or whatever it is called.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

kissa49
Starting Member

10 Posts

Posted - 2009-12-11 : 23:36:18
Unfortunately I need to stay in SSIS
Go to Top of Page

kissa49
Starting Member

10 Posts

Posted - 2009-12-11 : 23:50:20
I think that I can use filestream to open the file, write my txt string to it, and then close it. Can not find anything on how to do that anywhere.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-12 : 13:01:24
Well you can do what I said in SSIS, that's what I offered it as a suggestion. You can call DOS commands from SSIS, I just don't know the name of the task to select.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

kissa49
Starting Member

10 Posts

Posted - 2009-12-13 : 09:02:34
Thanks, I will try that.
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-12-13 : 12:31:41
Did you try the other suggestion?
Go to Top of Page
   

- Advertisement -