Sunday, October 9, 2011

FIX: SQL Server Bulk Insert or Upload Error

Bulk Insert - BCP : An unexpected end of file was encountered in the data file. Here are the common issues / problems while bulk inserting data file. 

Issue #1
When 'Number of columns' is less than the actual columns mapped, the error is:
Msg 4832, Level 16, State 1, Line 1
Bulk load: An unexpected end of file was encountered in the data file.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

Issue #2
When 'Number of columns' is more than the total number of columns in table or in format file, the error is: 

       Msg 4823, Level 16, State 1, Line 2 
          Cannot bulk load. Invalid column number in the format file 

Issue #3
When 'Number of columns' is any number between the number of mapped columns and the total number of columns in the table, the BULK INSERT worked fine. 

Resolution: 
1. Make sure that there are no additional blanks / space at the end of the file.
2. Make sure that yur csv file doesn't have any blank rows at the top.
3. Make sure that the ROWTERMINATOR is actually \n and not \r\n

Import CSV File Into SQL Server Using Bulk Insert. Bulk upload. About Bulk Import and Bulk Export Operations. BULK INSERT error. Bulk Insert into SQL Server using SqlBulkCopy. SQL Bulk import from CSV. sql bulk upload problem. Error message when you use the BULK INSERT statement. Using bcp and BULK INSERT. SQL Server Bulk Import Tutorial. Bulk Insert Error. Bulk load data conversion error. BULK INSERT ERROR MESSAGE. Import CSV/TXT into SQL Server 2008 Database Table. in sql server 2012. in sql server 2008. in sql server 2005. How to import XML into SQL Server with the XML Bulk Load. Import Excel file into Microsoft SQL Server . importing 5 gig file into table. Cannot bulk load because the file could not be. SQL Server Bulk Load Error Message 4867. Save Insert Export Import Excel Data Into Sql Server SqlBulkCopy.

0 comments:

Post a Comment