0

I have a huge DB and one table in particular is missing rows. I know this to be true but I need to find the gaps and show them. The primary key is the sequence number column. I need to show the actual missing sequence numbers. This table has 76,054,525 rows of data.

Update, the sequence number is provided by our software and each one represents a unique "play" record. Our software does not allow for gaps in play sequence numbers. Any gaps would be missing data.

KevinW
  • 13
  • 3

1 Answers1

3

That is a gaps and islands problem and a lot of people have written about how to solve that. For example, Itzik Ben-Gan covered it in chapter 5 of the SQL Server MVP Deep Dives book

However, why are you worried about gaps in your identity column? That is something that naturally occurs and cant be prevented. You can read more about that here: http://sqlity.net/en/792/the-gap-in-the-identity-value-sequence/

Sebastian Meine
  • 11,260
  • 29
  • 41