SQL server bulk insert identity column -
i trying bulk insert table has identity column.but host file contains empty value identity column.when issue 'bcp' command,i error -
starting copy...
sqlstate = s1000, nativeerror = 0
error = [microsoft][sql server native client 10.0]unexpected eof encountered in bcp data-file
sqlstate = 23000, nativeerror = 515
error = [microsoft][sql server native client 10.0][sql server]cannot insert value null column 'unique_id', table 'xx.dbo.yyy'; column not allow nulls. insert fails.
sqlstate = 01000, nativeerror = 3621
warning = [microsoft][sql server native client 10.0][sql server]the statement ha s been terminated.
bcp copy in failed
if dont give empty value identity column,then error - unexpected eof encountered in bcp data-file.
please in getting bcp work bulk insert table..
although suggest bulk insert data staging table first , insert data main table staging table. way can preserve identity columns. next way add additional id column host file , keep column blank , bulk insert. please confirm if not using keepidentity keyword in bulk insert query.
Comments
Post a Comment