Identity problem v MS SQL 2012

ENGLISH

One month ago we upgraded old MS SQL 2000 to 2012 version. It was all ok until I didn’t found out that in one table the serial number jumped for 1000 places! This was important for program who was using this table. The serial numbers has to be one after another. And how to set the serial number to last normal number? I had to found out why this happened. After long trying and “googling” I found the sollution – thanks to Manoj . This is the bug in MS SQL 2012 and there is still no fix! Luckily there was a solution to.

We use sql sentence which our identity value sets to wanted number. Example:

DBCC CHECKIDENT (table name, reseed, new value);
DBCC CHECKIDENT (Delavci, reseed, 234);

 

SLOVENSKO

Pred enmi mesecem smo stari MS SQL 2000 nadgradili na 2012 verzijo. Vse je bilo ok dokler v eni izmed tabel nisem opazil, da je zaporedna številka polja (zaporedna številka) preskočila 1000 mest! Ker pa je bilo pomembno v tabeli, da so zapisi oštevilčeni po vrsti sem se lotil problema, kako naj pripravim polje, da šteje od prejšnje številke. Ter seveda, da ugotovim zakaj je do tega prišlo.
Po dolgotrajnem probavanju in “googlanju” sem našel rešitev problema – hvala Manoj . Ta napaka je hrošč v MS SQL 2012 in zanj še ni popravka! Super. Na srečo sem našel tudi rešitev.

Zadevo rešimo z ukazom, ki našo vrednost identity nastavi na željeno številko. Primer:

DBCC CHECKIDENT (ime table, reseed, nova vrednost);
DBCC CHECKIDENT (Delavci, reseed, 234);

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *