December 13, 2005 at 8:05 am
I have a SQLBULKUpload script that uploads XML files into a simple parent/child table pair.
My problem is that if the child table has an identity column, whether at the beginning or end of the table structure the upload fails with "Cannot insert NULL value into primary key".
Is there something I can put in the schema to let SQLBULKUpload know that it shouldn't attempt to put data into the identity column.
December 13, 2005 at 6:53 pm
If "Cannot insert NULL value into primary key" is your message, it doesn't sound like not attempting to put data into it is the problem. Sounds more like your script identifies the primary key column and there is no related data. If you are not turning off the identity feature and setting the PK manually, then you need to take the PK field out of the defintion and let the identity field do its' thing and create the key.
December 14, 2005 at 1:44 am
I was revisiting the problem I posed in http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=21&messageid=229499
The child table has an identity field called SelectionId which isn't mentioned in the schema at all and yet the bulk copy tries to insert values into it.
December 14, 2005 at 1:53 am
When execting the bulk load have you got the KeepIdentity property set to False ?
December 14, 2005 at 6:53 am
Thanks Noggin, that fixed it
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply