How to delete Blank Lines in Text file

  • Hi.

    I am running a BulkInsert statement and the text files I have are generated by another system that I have no control over. What this systems does is append 7-8(the number is inconsinstant) blank lines at the end of the data.

    Now sql complains everytime about these lines, If I manually delete them, the bulk Insert works.

    How can I programmatically remove these lines in a very quick way. I do not want to use the readline method as it is too slow, I prefer the read method of the TextStream Object as it is much quicker. Will you guys help with a quick way to delete these lines and leave the file cursor at the end of the last data line and NOT at beginning of the last empty line.

  • Please do not cross post. Duplicate message please post/see response in http://www.sqlservercentral.com/forum/topic.asp?TOPIC_ID=4089&FORUM_ID=19&CAT_ID=3&Topic_Title=BulkInsert+problem&Forum_Title=Data+Transformation+Services+%28DTS%29

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply