sql server - Bulk insert not working for NULL data -
when inserting bulk data table csv file, not working, showing error lie :
bulk load data conversion error (type mismatch or invalid character specified codepage) row 2, column 9
column 9 value in csv file null..
how take care of this?
from amount of information i'd target table's particular field defined "not null". workaround issue have to:
a) modify csv-->add value field(s) have null
b) modify target table setting affected fields 'nullable':alter table [tblname] alter column [nulcolname] [vartype such int] null
in case go solution , want turn table's status alter again:update [tblname] set [nulcolname]=-1000 [nulcolname] null
avoid alter errors, alter table [tblname] alter column [nulcolname] [vartype such int] not null
c) pretty 'b' option bit more professional , faster: create temp table based on target table allowing nulls , fields, update temp table's null records after csv import "default value" , copy data target table
if i'm right issue , there's no option revise csv i'd go option 'c'