By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,364 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,364 IT Pros & Developers. It's quick & easy.

missing values of a sequence

P: 1
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
Share this Question
Share on Google+
1 Reply


deepuv04
Expert 100+
P: 227
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.