Timestamp field in SQL and NAV2016

In SQL you have the timestamp field. Each table in NAV has it, but it is not shown in NAV. In NAV2016 you have the possibility to show it as you probably already found out.

Important to know is that the timestamp field does NOT contain a time in it (talking about a bad name for a field…). It is just some versioning ID. Each time a record is inserted/updated, it the value is increased by 1. But not necessary for the same record. I have noticed that a value “x” is used only once for a record in the whole database! This means that there is max 1 record in the whole database with a certain timestamp value (if you update the record, it will get a new timestamp value and the old timestamp value will disappear from the database).

So when you need to know the records that where changed, get the records with a timestamp larger than the largest one that you found last time (you will need to save that value somewhere).

I did a small test:

I created a key on the timestamp-field (I gave it a different name (not “timestamp”)) and that was not a problem.

Not having a key on the field will mean that SQL has to scan the whole table to find the records you are searching for.

Filed under: NAV, SQL

Comment List