Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing records in SQL server tables

I have a database in place with a client that seems to lose data overnight. They enter records and exit the system, and then claim to not be able to find them again the next day.

The ID numbers in the Primary Key Index of the affected tables do seem to have gaps in, when they should be auto-incremented and continuous. The client does not have the facility to delete records, so there seems to be an issue.

I have tried using DBCC CHECKDB and DBCC REINDEX but the records do not re-appear and the issue continues.

On exit from the VB.NET 2010 app, I use the following to write the record for each table:

Me.binds_Tablename1.EndEdit()
Me.binds_Tablename2.EndEdit()
TableAdapterManager.UpdateAll(Me.Dataset_1)

This system has worked fine for 2 years, but is now playing up. Could database corruption be the issue?

like image 285
rev_dev_01 Avatar asked Jan 10 '12 15:01

rev_dev_01


People also ask

How do you handle missing data in SQL?

Using the SQL COALESCE function, it is easy to replace missing or NULL values in SELECT statements. Specific values can be set directly with COALESCE and the mean, median or mode can be used by combining COALESCE with WINDOW functions.

How do you add missing values in SQL?

In SQL, due to lack of data, we sometimes need to insert rows with NULL values in the tables. Here, the keyword NULL(without quotes) is used to represent no data.


1 Answers

since this just started, is it possible that they are entering 2012 somewhere or it is related to the year 2012, maybe this value does not exist in a lookup table, the transaction gets rolled back

When a transaction rolls back the identity value is NOT reused, this is why you see gaps, you need to find out why you have rollbacks

like image 63
SQLMenace Avatar answered Oct 15 '22 19:10

SQLMenace