Generally, we are using identity column into table where
identity value incrementally inserted. DBCC command RESEED is used to
reseed (reset) column identity. For example, your table has 20 rows that means
last identity value is 20. if you want to reseed identity value will be 30, you
can run following TSQL.
DBCC CHECKIDENT (yourtable, reseed, 29);
if You reseed identity value which is below in
current table, it will violate the uniqueness constraint as
soon as the values start to duplicate and will generate error.
If you delete last row in
current table and insert new row into current table, your new inserted identity
value will be last (deleted identity value + incremental value). For
example, you delete last three rows where Identity value is 20 - 22 ,so if you
now insert new row, identity value will be 23. That means seed value keep
into transaction log.
Comments
Post a Comment