Click here to Skip to main content
16,004,782 members
Home / Discussions / Database
   

Database

 
GeneralRe: Importing a Tab delimited report file Pin
Jack Fleet3-Aug-07 12:26
Jack Fleet3-Aug-07 12:26 
QuestionMySQL/ODBC Table will not Update from DataGrid [modified] Pin
][cecu3e2-Aug-07 6:52
][cecu3e2-Aug-07 6:52 
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 
You are welcome.

Finding the 'last' missing number was pretty easy. The query just subtracts one from every ID and sees if it is already there and that it isn't the first assigned id.
SELECT     
    [MyID] - 1 AS MissingNumber
FROM     
    [MyTable] 
WHERE     
    [MyID] - 1) NOT IN (SELECT [MyID] FROM [MyTable]) AND    
    [MyID] != 1

Finding the first missing number uses a correlated subquery. If you look at that query by itself it is pretty clear. I added the ISNULL because the first record will have no preceeding records and therefore, return NULL.
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 
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 

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.