Arvind
Arvind

Reputation: 6474

"Data conversion error" with BULK INSERT

I am trying to import some data into SQL Server using the Bulk insert command--

This is the error I am getting--

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 6 (NClaims).

Now, I created a test file with only one row of data which I was able to import successfully--

00000005^^18360810^408^30^0

However when I added 2 more rows of data (which are very similar to the row above) I got the error message that I have given above. These are the 2 additional rows of data--

00000003^^18360801^142^42^0
00000004^^18360000^142^10^0

As you can see there does not seem to be any difference (in terms of data length or data types for the 2 rows above compared with the single row given previously)... So why am I getting this error? How do I fix it?

EDIT--

This is the command I am executing--

BULK INSERT GooglePatentsIndividualDec2012.dbo.patent
FROM 'C:\Arvind Google Patents Data\patents\1patents_test.csv'
WITH ( FIELDTERMINATOR = '^', ROWTERMINATOR='\n');

Upvotes: 1

Views: 1257

Answers (1)

Serg
Serg

Reputation: 2427

Be patient and make experiments excluding one thing at a time. For example:

  1. Remove third row and check if everything ok.
  2. If yes, return this row but change 10^0 to 42^0, check again.
  3. Repeat step 2 with all data changing it to values in row 2 which is ok.

You will find the piece of data which causes error.

Upvotes: 1

Related Questions