问题描述
使用Visual C#2008 Express和SQL Server 2008 Express,我想将新记录插入数据库AdventureWorks,表格Person.Contact。
到我的令人惊讶的是,这个表的'int-value identity列" ContactID"似乎不是自动增量。我不知道如何确认这是如此。 (我已经安装了SQL Server Management Studio,如果有帮助的话。)
如何确认这一点,以及如何使ContactID自动增加?
顺便提一下,自动递增会从最高的现有ContactID开始递增,还是会先使用表中不存在的较小的ContactID值(可能是由于删除)?
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)?
推荐答案
这篇关于自动增量标识列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!