FIND MISSING NUMBER
https://www.dbrnd.com/2015/06/query-to-find-missing-number-id-sql-server/ Query to Find Missing Number and ID in SQL Server In this post, I will give you one full demo to find a missing number of identity column in SQL Server. Before a few days ago, I was working on production report and found that some number is missing. This sequence and missing number are very important. Immediately one requirement come to my desk is, please find a list of all missing number for investigation purpose. Below is a full demo script to find the missing number in SQL Server. First Create one sample table with data. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 /*Create one table to store Numbers*/ CREATE TABLE dbo.tbl_Numbers ( ID INTEGER ) GO /*Insert some test records. You can also see I have missed many number which we are going to find by query*/ INSERT INTO dbo.tbl_Numbers VALUES (1),(2),(3),(4),...
Comments
Post a Comment