PJLewis2015
asked on
How to add a footer to a text file in SSIS (Visual Studio 2010)
How does my SSIS job append a footer to a text file that has just been written?
ASKER
Thanks for the quick response Barry. Unfortunately, I barely remember my VB Script and have not used C#.
I am trying to append "EOF" to the flat file (customer requirement). The number of records can be large.
Is there a way I could use T-SQL to attach "EOF" as the last row in the result set?
I am trying to append "EOF" to the flat file (customer requirement). The number of records can be large.
Is there a way I could use T-SQL to attach "EOF" as the last row in the result set?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks and it works.
FYI, I found a faster way:
Let's say I use a simple SQL query:
SELECT ID, NameF, NameL FROM Employee.
Then for giggles, I tried a UNION
SELECT SSN, NameF, NameL FROM Employee
UNION
SELECT TOP 1 '' AS SSN, '' AS NameF, '' AS NameL FROM Employee
ORDER BY SSN
It worked when I used the second SQL query above in the SSIS package!
FYI, I found a faster way:
Let's say I use a simple SQL query:
SELECT ID, NameF, NameL FROM Employee.
Then for giggles, I tried a UNION
SELECT SSN, NameF, NameL FROM Employee
UNION
SELECT TOP 1 '' AS SSN, '' AS NameF, '' AS NameL FROM Employee
ORDER BY SSN
It worked when I used the second SQL query above in the SSIS package!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You aren't 'da man' - you're his big brother!
Thanks for your advice.
Thanks for your advice.
After your Dataflow task which creates the text file, add in a Script Task.
In this Script Task you can write C# code which opens the text file and appends the necessary footer lines.
In C# you can use the StreamWriter object to achieve this.