Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Idea's for solution help

Status
Not open for further replies.

aspvbnetnerd

Programmer
May 16, 2006
278
SE
I have table and I have 2 columns that are very important and those column are FirstSerialNumber and last LastSerialNumber

The firstserialnumber should begin with last serialnumber + 1. If you could se with this example below this is okay.

Code:
FirstSerialNumber    LastSerialNumber
24888                25049
25050                25159
25160                25296
25297                25440

Now we have problem that there is a gap in our table like this
With the example below you could se that there is a gap with number the number 25160 is missing.
Code:
FirstSerialNumber    LastSerialNumber
24888                25049
25050                25159
25297                25440

I have to prevent the gap from happening next time a missing serialnumber is inserted.

Now to my question. Should I create a new table that holds last serialnumber or something else?

I know you have a better solution for the

Any ideas is appreciated.

/George
 
I think more information on what you are doing would be helpful, but wouldn't you want some sort of constraint to ensure that upon insertion, FirstSerialNumber = max(LastSerialNumber) + 1?

Or do you want to be able to insert a later FirstSerialNumber, and fill in the gap later?

Good Luck,

Alex

[small]----signature below----[/small]
With all due respect, Don Bot, I don't think we should rely on an accident happening. Let's kill him ourselves.

Ignorance of certain subjects is a great part of wisdom
 
Hi Alex.

Thanks for the response.

The problem is that the after the the lastserialnumber reaches 99999 it starts from 00001 so the number can be reused.

So a number can be reused so a number can exists many times.

I have to check that last inserted is correct with the new data. if lastserialnumber is 10001 the new data of the firstserialnumber is 10002 then everything os okay.

If the new data that is being inserted is and the firstserialnumber begins with 10010 the I should not be inserted to the database.

Info about data in

Hope you understand my problem better now.

/George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top