Link to home
Start Free TrialLog in
Avatar of UnderSeven
UnderSeven

asked on

Unexpected end of file with bulk insert

In SQL server I am receiving a data file with blank lines at the end of it, I'm not sure if there is a way with a bulk insert to ignore those lines.  Adding at the last column to end with a /r/n only causes it to have an unexpected end of file error due to those blank lines.  I need if possible, a solution on how to either get rid of those blank lines with a relatively simple dos script or to make bulk insert ignore them.  Having the initial data file simply not include those lines is not an option.

I am using SQLserver2005
ASKER CERTIFIED SOLUTION
Avatar of Yveau
Yveau
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of UnderSeven
UnderSeven

ASKER

I ended up using %G for my param, but it worked like a charm.  I thought I would have to write some C# code, but it didn't occur to me to use ECHO instead of FIND (as you know find places lines in your file and doesn't really work right anyway for this).  Also the for loop was great.  Thanks a lot for this response, it was just what the doctor ordered.
:-)
Glad I could be of any help !