October 17, 2002 at 8:39 am
Is there a way to autopopulate the primary as can be done in Access?
-David
October 17, 2002 at 10:19 am
If designing a table in Enterprise Manager, set the Identity property of your primary key (which would typically be an 'int') to "Yes".
October 17, 2002 at 12:24 pm
Yes, thanks. DTS is generating an error when data is loaded. I'm loading from an excel spreadsheet and the error is: "Cannot insert the value NULL into the column 'key', table 'NW.dbo.dataL', column does not allow nulls. INSERT fails." I'm using DTS to transform the data. I need the primary key field to autopopulate but when the loader gets down to the last row of the excel spreadsheet the next row is just a blank line and somehow DTS doesn't know this is the end of the file data and throws the NULL error. An identity key will not allow nulls which of course I wouldn't want anyway.
October 18, 2002 at 12:13 pm
Okay, I figured out the problem. In DTS there is a checkbox that say "enable identity insert." It must be unchecked which seems counterintuitive because identity insert (autopopulation) is what is desired.
October 21, 2002 at 5:00 am
identity_insert allows you to specify the identity value yourself rather than have it generated for you, i.e if your excel spreadsheet has values for the column
Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply