Click here to Skip to main content
15,894,343 members
Home / Discussions / Database
   

Database

 
Questiondriver help Pin
boyindie2-Aug-07 4:56
boyindie2-Aug-07 4:56 
Questionreturning free numbers Pin
ArielR2-Aug-07 4:30
ArielR2-Aug-07 4:30 
AnswerRe: returning free numbers Pin
kubben2-Aug-07 7:22
kubben2-Aug-07 7:22 
AnswerRe: returning free numbers Pin
Michael Potter2-Aug-07 9:16
Michael Potter2-Aug-07 9:16 
GeneralRe: returning free numbers Pin
ArielR2-Aug-07 13:06
ArielR2-Aug-07 13:06 
GeneralRe: returning free numbers Pin
Michael Potter3-Aug-07 10:13
Michael Potter3-Aug-07 10:13 
GeneralRe: returning free numbers Pin
DQNOK3-Aug-07 10:32
professionalDQNOK3-Aug-07 10:32 
GeneralRe: returning free numbers Pin
Michael Potter3-Aug-07 13:35
Michael Potter3-Aug-07 13:35 
You are correct in your speed assumptions. When used on an primary key, my code would result in a binary search of the index. Your method would be significantly faster on larger tables especially since NOT IN is a very slow operation.

You would still have to acquire the first ID in a missing hole. It would be easy enough to re-insert the correlated subquery (will slow it down a bit) by using your final query as the source for a new query.

The only way I can see for locating all missing IDs is to use a while loop, a cursor or building a table of integers as the first respondent mentioned. Normally, I would leave further analysis to a client application where iteration through the result set is a simplistic operation.
QuestionSimple E-mail functionality Pin
Bonsta2-Aug-07 4:26
Bonsta2-Aug-07 4:26 
AnswerRe: Simple E-mail functionality Pin
Sunset Towers2-Aug-07 7:21
Sunset Towers2-Aug-07 7:21 
QuestionCounting the Records in a Database for a Insert Statement Pin
Sunset Towers2-Aug-07 3:25
Sunset Towers2-Aug-07 3:25 
AnswerRe: Counting the Records in a Database for a Insert Statement Pin
kubben2-Aug-07 3:29
kubben2-Aug-07 3:29 
GeneralRe: Counting the Records in a Database for a Insert Statement Pin
Sunset Towers2-Aug-07 3:37
Sunset Towers2-Aug-07 3:37 
GeneralRe: Counting the Records in a Database for a Insert Statement Pin
Sunset Towers2-Aug-07 5:10
Sunset Towers2-Aug-07 5:10 
GeneralRe: Counting the Records in a Database for a Insert Statement Pin
kubben2-Aug-07 5:22
kubben2-Aug-07 5:22 
GeneralRe: Counting the Records in a Database for a Insert Statement Pin
kubben2-Aug-07 5:43
kubben2-Aug-07 5:43 
GeneralRe: Counting the Records in a Database for a Insert Statement Pin
Sunset Towers2-Aug-07 6:01
Sunset Towers2-Aug-07 6:01 
GeneralRe: Counting the Records in a Database for a Insert Statement Pin
kubben2-Aug-07 6:29
kubben2-Aug-07 6:29 
GeneralRe: Counting the Records in a Database for a Insert Statement Pin
Sunset Towers2-Aug-07 7:18
Sunset Towers2-Aug-07 7:18 
GeneralRe: Counting the Records in a Database for a Insert Statement Pin
kubben2-Aug-07 7:20
kubben2-Aug-07 7:20 
GeneralRe: Counting the Records in a Database for a Insert Statement Pin
Sunset Towers2-Aug-07 7:22
Sunset Towers2-Aug-07 7:22 
GeneralRe: Counting the Records in a Database for a Insert Statement Pin
kubben2-Aug-07 7:25
kubben2-Aug-07 7:25 
GeneralRe: Counting the Records in a Database for a Insert Statement Pin
Sunset Towers2-Aug-07 7:37
Sunset Towers2-Aug-07 7:37 
GeneralRe: Counting the Records in a Database for a Insert Statement Pin
kubben2-Aug-07 7:51
kubben2-Aug-07 7:51 
GeneralRe: Counting the Records in a Database for a Insert Statement Pin
Sunset Towers2-Aug-07 8:24
Sunset Towers2-Aug-07 8:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.