auto-increment identity column

Status
Not open for further replies.

BobLewiston

In Runtime
Messages
182
Using Visual C# 2008 Express and SQL Server 2008 Express, I would like to insert new records into database "AdventureWorks", table "Person.Contact".

To my surprise, this table's int-value identity column "ContactID" does not appear to be auto-increment. I don't know how to confirm for sure that this is so. (I have installed SQL Server Management Studio, if that helps.)

How can I confirm this, and how can I make ContactID auto-increment?

And incidentally, will auto-increment just start incrementing from the highest existing ContactID, or will it first use lesser ContactID values that are absent from the table (presumably due to deletions)?
 
Not sure specifically about MS products but if it is like everything else it will go from the highest and will not go back on itself too "fill in" deleted records. The easiest way to confirm whether the field is auto-incrementing is either to look at the table structure or to do an sql insert explicitly giving the other fields and their values but not the ID. If the ID is, as it should be - an auto-incrementing primary key, the database will insert an incremented ID for you.
 
Status
Not open for further replies.
Back
Top Bottom