Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » auto-increment identity column
Closed Thread
Old 03-24-2009, 07:17 PM   #1 (permalink)
 
Junior Techie

Join Date: Nov 2008

Posts: 79

BobLewiston is on a distinguished road

Default auto-increment identity column

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)?
BobLewiston is offline  
Old 03-24-2009, 08:00 PM   #2 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,158

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: auto-increment identity column

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.
__________________
MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11


There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page
kmote is online now  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
The Tech Forums Official 3DMark06/03 Top List gurusan Overclocking, Case Mod, Tweaking PC Performance 4136 10-29-2009 04:40 PM
Blue Screen of Death -> Help ! Prisonbreak94 Windows Operating Systems and Software 52 10-19-2008 10:01 AM
EP45-DS3R won't allow Q9450 overclock past 3.2GHz or retain manual voltage settings mikeynavy1976 Overclocking, Case Mod, Tweaking PC Performance 24 08-20-2008 02:59 AM
***Thailand Halts Grand Theft Auto Sales After Murder*** Luke PC Gaming 43 08-11-2008 01:48 PM
Anyone Else have a Asus p5e x38? Drizzt Overclocking, Case Mod, Tweaking PC Performance 2 05-09-2008 08:00 PM