Hi all,
I have a Identity increament column name "ID" (int). Now i have values
in that column :
+--+
| ID |
+--+
| 1 |
| 2 |
| 100 |
| 101 |
| 102 |
| 104 |
| 105 |
| 106 |
| ... |
In which situation that the value of ID column will be 3 to 99, 103 ?(
Or it's values will increase up to MAX INT and never re-use 3-99, 103
).
Thanks for reading.Hi There,
The values 3-99 and 103 will not be used. Having gaps for Identity
columns isn't anything to stress about, though.
Gaps don't really matter as the Identity column will still do what it's
supposed to do and that is give you a value in that column that is
unique among all other values in that column.|||On 28 Apr 2006 01:37:16 -0700, tienlx wrote:
>Hi all,
>I have a Identity increament column name "ID" (int). Now i have values
>in that column :
>+--+
> | ID |
>+--+
>| 1 |
>| 2 |
>| 100 |
>| 101 |
>| 102 |
>| 104 |
>| 105 |
>| 106 |
>| ... |
>In which situation that the value of ID column will be 3 to 99, 103 ?(
>Or it's values will increase up to MAX INT and never re-use 3-99, 103
> ).
>Thanks for reading.
Hi tienlx,
You can use DBCC CHECKIDENT to control the next value of IDENTITY, so
that would be a way to force creation of 3 as the next value. Note that
this won't detect that 100 is already is use - if you don't reset the
identity (using DBCC CHECKIDENT again) after value 99 is generated, the
next value will be 100 and you'll either get a constraint violation or a
duplicate row (if you forgot to include a constraint).
Hugo Kornelis, SQL Server MVP
No comments:
Post a Comment