Suppose I have a table, the first column is an identity. I thought that the value was increated by one automatelly.
Say I have this column as
1
2
3
4
...
47
48
49
50
If I delete the last row(id = 50) and insert a new row, why the identity is 51 rather than 50?
Thanks.
The value is used up whether the row exists or not. In addition to deletes, you will also see gaps when an insert is rolled back. If you want a contiguous sequence of integers, identity is not the answer.