• Sorry. forgot to replace the table names in the cte.

    DECLARE @MissingNumbers TABLE (N INT)

    Declare @vMax int

    INSERT INTO @MissingNumbers

    VALUES (19),(20)

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

    ;with wcte as (

    Select Top(@vMax) ROW_NUMBER() over(order by a.Object_id,a.Column_ID) NAll

    from sys.columns a, sys.columns 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]