Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Can I use the

DBCC CHECKIDENT(<table_name>, RESEED, value)

command to reset an identity column current value to the original one in SQL Server 2008?

If yes, is this the correct way of doing this operation without having any drawback? If not, is there an alternate way of doing this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
345 views
Welcome To Ask or Share your Answers For Others

1 Answer

The value can be omitted. So if you use

DBCC CHECKIDENT (<table_name>, RESEED);

SQL Server sets the ident value to the correct next number - according to the numbers already in use. This is the only way to reseed identity values I know.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...