Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
Hello Everybody,
How to Skip auto incremented id in sql server
For Example,
Id Name
=====================
1 John
2 Mark
3 Kevin
4 Peter
6 Joe

If the input is number 2 then i want to skip those related ids and result should be like this

Id Name
======================
1 John
3 Kevin
6 Joe

THANK YOU
Posted
Updated 31-Mar-14 19:46pm
v2
Comments
King Fisher 1-Apr-14 1:57am    
1,3,5 or 1,3,6
Member 10017719 1-Apr-14 2:06am    
1,3,6... Its not depend on multiples of any number..its depend on occurence of input number
King Fisher 1-Apr-14 2:10am    
its not quite clear. why do you want to skip 5? show the series
Member 10017719 1-Apr-14 2:43am    
I m not skipping 5..consider id 5 is not available
Schatak 1-Apr-14 3:06am    
what should be the output if you are inputting 3?

1 solution

I solved it my using while loop
 
Share this answer
 
v2
Comments
King Fisher 1-Apr-14 7:19am    
good ;)
Schatak 1-Apr-14 7:36am    
cool

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900