How to find number in series is not entered in table

  • I ran my code over millions records, no problem ..too fast

    Play fair, this is your code which you posted originally ...

    The problem is, missing records on sequence don't appear, It will appear just one!

    SELECT missing = T.id + 1

    FROM dbo.#tb_temporaria T

    WHERE T.id BETWEEN 0 AND 999

    AND NOT EXISTS

    (

    SELECT 1

    FROM dbo.#tb_temporaria T2

    WHERE T2.id = T.id + 1

    );

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply