Possible corruption of the index?

Proof

In the above image, you can see that I have a table, that when I request the maximum field value from it, I get different results based on the where clause, which the rest of the queries seem to exclude as irrelevant.

Back end - MSDE 2000, front end is an application written in VB.NET 2008, verification is performed using SSMS 2008R2, connected to the MSDE instance via VPN.

This is a closed application development system, however, if I can fix everything that causes this, I believe that both the database and the application will resume work.

The problem is that it asks for Max ([record_index]) + 1, where [station_id] = 10, the value appears as an entry that already exists in this table, and the insert does not work due to a unique constraint.

+4
source share
1 answer

Reindex from the PK index solved the problem and ran the above queries for Max ([record_index]) to return the same number as Max ([record_index]). WHERE ... return the same numbers as they should. Thus, at the moment, index corruption is the only logical answer. The DB mechanism is 12 years old, and this is the only time it has ever happened to us, I think I just have to accept it

+1
source

Source: https://habr.com/ru/post/1416045/


All Articles