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

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

Member Avatar for stbuchok

looks like the date formats don't match

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

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

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?)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.