I have a strange and somewhat worrying problem with a customer's Change Log: the Entry No. field is not sequential. This field has the (SQL) attribute AutoIncrement=Yes.
The problem has occurred twice, both times across dates. I suspect both have happened in conjunction with a server reboot.
30-09-14: Entry No. = 11192
01-10-14: Entry No. = 21191
A couple of weird things about this that are probably random, is that the the gap is 9999 and that the first and last digit are swapped.
05-01-15: Entry No. = 26388
06-01-15: Entry No. = 36367
This time the gap is 9979.
It's impossible for the gaps to have occurred because entries in the log have been deleted.
The customer (and in particular their accountant) more or less demands an explanation of this problem which I find totally reasonable. My problem is that at the moment my best reply is that it's SQL Server that is maintaining that field and that the problem must somehow be related to the (assumed) server reboots.
Can anyone come up with something better?
Brian Rocatis
Senior NAV Developer
Elbek & Vejrup
0
Comments
Of course, another "why" could be that entries are deleted, than you need to check the permissions (who has delete permissions on the table) and who has access to the SQL directly.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Besides, it's simply impossible that the table should have almost 10000 uncommitted transactions - twice. Bear in mind that the numbers tell us that around 5000 entries are created over a three month period.
I guess it's a theoretical possibility but that would entail that somebody in less that 24 hours (18, in fact) actually created 10000 entries and then deleted them. Seeing as changes done in code does not affect the Change Log, that would mean that somebody actually sat down before the screen and did 10000 changes. That comes out as about 10 changes a minute :shock:
Senior NAV Developer
Elbek & Vejrup
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Anyways, I found the answer: it's a "feature" in SQL Server: http://www.codeproject.com/Tips/668042/SQL-Server-2012-Auto-Identity-Column-Value-Jump-Is. In other words, if you want to make sure you're dealing with an unbroken sequence of entries, do not use AutoIncrement.
Senior NAV Developer
Elbek & Vejrup
But I am happy that you have found the reason, very interesting, I have not met it yet, but I am sure I will...
:thumbsup:
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Also when you insert 1000 records, and the auto increment sits at 1000, and then you delete all records, SQL Server will issue the next number at 1001. It doesn't care about keeping the sequence intact.
Yep
RIS Plus, LLC