472,133 Members | 1,090 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,133 software developers and data experts.

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 1216
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.