Skip to content

Instantly share code, notes, and snippets.

@parabola949
Created October 10, 2014 16:16
Show Gist options
  • Save parabola949/e1c688c2e208a5ef0841 to your computer and use it in GitHub Desktop.
Save parabola949/e1c688c2e208a5ef0841 to your computer and use it in GitHub Desktop.
DECLARE @numberlist table(number int)
-- TOP <max> IDENTITY(int,<min>,1)
SELECT TOP 5 IDENTITY(int,1,1) as Number
INTO numberlist
from sys.objects s1 CROSS JOIN sys.objects s2
--Now check range against stuff table
SELECT *
FROM numberlist
WHERE number NOT IN (Select Number from Stuff)
DROP TABLE numberlist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment