November 13, 2010 at 8:18 am
I have an identity column in a table with an incremental seed of 1 and starting with 1
I have inserted 5 rows where the last identity value would be 5
suppose i delete the 5th row and when i insert another row the identity column value would contain 6.
so where exactly sql server saves the last identity value of a table.
November 14, 2010 at 3:45 am
to check the last\current id column value used execute the following query
dbcc checkident('tablename', noreseed)
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
November 14, 2010 at 8:06 pm
vamshi.kotagiri (11/13/2010)
I have an identity column in a table with an incremental seed of 1 and starting with 1I have inserted 5 rows where the last identity value would be 5
suppose i delete the 5th row and when i insert another row the identity column value would contain 6.
so where exactly sql server saves the last identity value of a table.
It's stored internally, not in a table you can update directly (or even see).
The only way to change it is via the DBCC CHECKIDENT utility.
If you just want to see what the last value used was, and other information about the column with the identity property, query the system view sys.identity_columns.
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
November 15, 2010 at 5:42 am
SELECT IDENT_CURRENT('my_table')
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply