• Hi...

    DECLARE @MissingNumbers TABLE (N INT)

    Declare @vMax int

    INSERT INTO @MissingNumbers

    VALUES (1),(2),(4),(5),(7),(8),(11),(12),(13),(15),(17),(19),(20)

    Set @vMax = (Select MAX(N) from @MissingNumbers)

    ;with wcte as (

    Select Top(@vMax) ROW_NUMBER() over(order by a.N) NAll

    from @MissingNumbers a, @MissingNumbers b

    ) Select NAll from wcte a

    Left outer Join @MissingNumbers b on b.N = a.Nall

    where b.N is Null

    Atif SHeikh

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]