Detecte trailing record | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Detecte trailing record

My text file has a trailing record like: TRAILER RECORD0000000851 This will cause problem for my import DTS. How can I get ride of the trailing record? Thanks, CanadaDBA
A friend suggested me to use FINDSTR to remove the trailing row from my file. Here is what I did:
FindSTR /V "TRAILER" Insurance.txt > InsuNew.txt
Since I am going to use an SP and DTS, I have to run this command from within the SP and then call the DTS? Is there any better suggestion?
CanadaDBA
If you create a batch file or an exe file to strip the last line you can call this file from within DTS. Use the execute process task to call your exe or batch file and then use this new file as the source for your DTS import.
]]>