Syed Mhamudul Hasan
Syed Mhamudul Hasan

Reputation: 1349

Auto increment of identity to a specific number in Sql server

I have a DB where ID is bigint and auto incremented identity column.Works fine but suddenly it rises and starts from specific number ? enter image description here

i want to know why it is happening and how can i continue the increment from 152 again ????

Upvotes: 2

Views: 478

Answers (1)

ziad mansour
ziad mansour

Reputation: 349

This is all perfectly normal. Microsoft added sequences in SQL Server 2012, finally, i might add and changed the way identity keys are generated. Have a look here for some explanation.

If you want to have the old behaviour, you can:

1- use trace flag 272 - this will cause a log record to be generated for each generated identity value. The performance of identity generation may be impacted by turning on this trace flag.

2- use a sequence generator with the NO CACHE setting (http://msdn.microsoft.com/en-us/library/ff878091.aspx)

Upvotes: 5

Related Questions