July 21, 2010 at 1:29 pm
Hi,
I have a bulk insert statement that is loading a text file into a table. It is working fine when it has data in text file but fails when the text file has the text "EMPTY FILE". It is working fine in prod with "EMPTY FILE" text file but its not working in Dev (Bulk load: An unexpected end of file was encountered in the data file.
). Its driving me crazy, pls help me.
Bulk insert statement:
BULK INSERT database..tableAAA FROM 'd:\database\abc.txt' WITH (FORMATFILE = 'd:\database\format\aaaformat.fmt')
and the format file is
6.0
7
1 SQLCHAR 0 2 "" 1 aa
2 SQLCHAR 0 5 "" 2 bb
3 SQLCHAR 0 9 "" 3 cc
4 SQLCHAR 0 6 "" 4 dd
5 SQLCHAR 0 2 "" 5 ee
6 SQLCHAR 0 11 "" 6 ff
7 SQLCHAR 0 45 "\r" 7 filler
all the mapping is right and it works fine with the sample data in it but fails when the text file has "EMPTY FILE". This code is running on SQL 2005 SP3 on both the environments.
thanks,
ek
July 21, 2010 at 5:05 pm
I just got the prod version and it has try catch block to eat the exception ,ooo what a crud way http::crazy:
Never mind, pls ignore this
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply