Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Header and Footer to text file

Status
Not open for further replies.

Craig0201

Technical User
Oct 11, 2000
1,261
GB
I have some precreated text files which at present need headers and footers adding to them by hand. I cannot see a way of doing this at source as the header and footer do not have the same number of columns as the main data and SQL DTS requires a valid SQL statement.

What would be the best way of adding the header? I presume I could use a FileStream in append mode to add the footer easily.
 
Create a new file, write header, append old file, append footer.

__________________________________________
Try forum1391 for lively discussions
 
Massively slow when you have 160000 lines! But thanks for looking.

Was then about post a solution

Run the stored procedure

EXEC master..xp_cmdshell
'COPY /b C:\header\Header.txt + C:\body\Body.txt C:\full\Full.txt'

Craig
 
>Massively slow when you have 160000 lines! But thanks for looking.

It all depends on how you implement it.

__________________________________________
Try forum1391 for lively discussions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top