missing values of a sequence

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rambo1975
    New Member
    • Mar 2008
    • 1

    missing values of a sequence

    I have a column in my sql table which is an identifier and i want to find the missing sequence in that column@@##

    Please help me out as this might get me a scholarship.@@# #
  • deepuv04
    Recognized Expert New Member
    • Nov 2007
    • 227

    #2
    Originally posted by rambo1975
    I have a column in my sql table which is an identifier and i want to find the missing sequence in that column@@##

    Please help me out as this might get me a scholarship.@@# #
    Hi,

    try the following query...
    [code=sql]
    select t.sno
    from
    ( select row_number() over (order by Column_Name) as sno
    from Table_Name ) as t
    where t.sno not in (select Column_Name from Table_Name)
    [/code]

    here we are generating a serial number on the key column and retrieving the serial numbers which are not there in the table... which means missing sequences


    thanks

    Comment

    Working...