469,138 Members | 1,295 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,138 developers. It's quick & easy.

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.@@##
Mar 26 '08 #1
1 1190
deepuv04
227 Expert 100+
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...
Expand|Select|Wrap|Line Numbers
  1. select t.sno 
  2. from 
  3.  ( select row_number() over (order by Column_Name) as sno
  4.   from Table_Name ) as t 
  5. where t.sno not in (select Column_Name from Table_Name)
  6.  
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
Mar 26 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Alberto Grosso Nicolin | last post: by
4 posts views Thread by Mahesh BS | last post: by
8 posts views Thread by Elijah Cardon | last post: by
10 posts views Thread by Joel | last post: by
41 posts views Thread by Gary Wessle | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.