954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Bulk Insert Error

Hi All,

When I run this script using bulk insert i got an error message
but when I try the first 6 records there is no problem.
can anyone give the reason and what is the problem?

Use chrisMartin
Bulk Insert SampleTable_Jonel
FROM 'c:\planning\ProductRecoveryDataFeedytd_3.csv'   --Sheet 1
With
(
DATAFILETYPE = 'char',
FieldTerminator = ',',
CODEPAGE = 'OEM',
KEEPNULLS,
RowTerminator = '\n', FirstRow = 1)

Error message

Msg 4864, Level 16, State 1, Line 2
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 7, column 11 (InsertDate).
Msg 4864, Level 16, State 1, Line 2
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 11, column 11 (InsertDate).


thanks you.

jov

jovillanuev
Junior Poster in Training
76 posts since Jun 2011
Reputation Points: 10
Solved Threads: 0
 

how i will know what data is in the .csv file

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

looks like the date formats don't match

stbuchok
Master Poster
730 posts since May 2011
Reputation Points: 120
Solved Threads: 93
 

is it possible the data contains characters that would "break" the insert? eg. a VARCHAR value like: 'Stan's bbq'

Eagletalon
Junior Poster
113 posts since Mar 2011
Reputation Points: 47
Solved Threads: 13
 

may possible InsertDate is null in Excel file, validate Isnull(InsertDate) then set some date in query

crishlay
Junior Poster
132 posts since May 2010
Reputation Points: 10
Solved Threads: 16
 

Could you possibly provide some example data? perhaps the record that "breaks" the insert? (you mentioned the first 6 works, perhaps nr 7 is a problem?)

Eagletalon
Junior Poster
113 posts since Mar 2011
Reputation Points: 47
Solved Threads: 13
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You