Click here to Skip to main content
12,758,782 members (33,782 online)
Click here to Skip to main content

Tagged as


Posted 12 Nov 2012

How to find a gap in the table between min and max value using pure SQL

, 13 Nov 2012 CPOL
CREATE FUNCTION [dbo].[GetMissingNumbers](@ID int)RETURNS @MissingNr TABLE(MissingNumber int)ASbegin DECLARE @minValue int DECLARE @maxValue int Declare @checkValue int select @minValue = min(Sequence) from Table1 where ID = @ID select @maxValue = max(Sequence) from Table1...



Compare Revision Minor Date Status Editor
2 - publicly available No 12-Nov-12 19:22 Available digimanus
added call to the function
1 No 12-Nov-12 19:22 Available digimanus


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior)
Netherlands Netherlands
I started in the eightees with Basic and QuickBasic. When the ninetees started dBase was my thing. Close to the millenium years I swapped to C++ and since 2003 it is only programming in c#.

There is one thing about me.
Not that kind of OO guy and definately not an ORM-fan. I know a database to well to give the importance of data out in the hands of a tool.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170217.1 | Last Updated 13 Nov 2012
Article Copyright 2012 by digimanus
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid