Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Problem with BULK INSERT

Author  Topic 

daniel.newman@bis-web.net
Yak Posting Veteran

71 Posts

Posted - 2001-07-19 : 08:22:13
Hi all,

I'm trying to insert multiple records into a holding table. The data comes from a CSV file that is copied and pasted into an HTML form field. I save this as is to a txt file, and then pass this file path to a stored procedure to use the bulk insert method.

My file looks like this:
200001|1|'Title'|'Initials'|'Surname'|'Add1'|'Add2'|'Add3'|'Add4'|'Town'|'County'|'Coutry'|'PostCode'|'TelNo'|'FaxNo'|'Email'|'19/07/01'|'01/11/02'
200002|1|'Title'|'Initials'|'Surname'|'Add1'|'Add2'|'Add3'|'Add4'|'Town'|'County'|'Coutry'|'PostCode'|'TelNo'|'FaxNo'|'Email'|'19/07/01'|'01/11/02'
200003|1|'Title'|'Initials'|'Surname'|'Add1'|'Add2'|'Add3'|'Add4'|'Town'|'County'|'Coutry'|'PostCode'|'TelNo'|'FaxNo'|'Email'|'19/07/01'|'01/11/02'
200004|1|'Title'|'Initials'|'Surname'|'Add1'|'Add2'|'Add3'|'Add4'|'Town'|'County'|'Coutry'|'PostCode'|'TelNo'|'FaxNo'|'Email'|'19/07/01'|'01/11/02'
200005|1|'Title'|'Initials'|'Surname'|'Add1'|'Add2'|'Add3'|'Add4'|'Town'|'County'|'Coutry'|'PostCode'|'TelNo'|'FaxNo'|'Email'|'19/07/01'|'01/11/02'

And my stored procedure is trying to execute this command:

BULK INSERT Imported_Data FROM 'E:\NEXUS-ROOT\sts\_management\newupload.txt' WITH (DATAFILETYPE = 'native', FIELDTERMINATOR = '|', ROWTERMINATOR = '\n')

But I keep getting this error:

Bulk Insert: Unexpected end-of-file (EOF) encountered in data file.

I've tried everything I can think of to make this work:-
including a carriage return after the last record;
not including a carriage return after the last record;

but still I get this error.

Any advice?

Otherwise I'm going to have to insert each record one by one.

Daniel Newman.
   

- Advertisement -