PDA

View Full Version : SQL question


bono_head
03-26-2004, 05:44 AM
I kind of like this forum, and I wonder about one thing. I know this is maybe not the correct forum.But I try anyway...

I have a table with auto_increment not null primary key which adds up every time I insert something. Problem is that I also delete stuff for exameple
delete * from thistable where id_primkey like "04". then row 4 is empty.

What i want to do is that the next time I insert something, it checks and find the next empty place, and inserts it there.

My explanation and english is not so good, so I hope you understand what I am trying to do...

-b-

duffy90210
03-26-2004, 06:53 AM
The Auto-Incre may not allow you to do that as a field rule, what you should be doing instead is to submit a Compact statement to remove any records that are now hollow.

Once you have compacted the database/table, these empty record will now be removed and the space freed.

HTH

bono_head
03-30-2004, 09:39 AM
The Auto-Incre may not allow you to do that as a field rule, what you should be doing instead is to submit a Compact statement to remove any records that are now hollow.

Once you have compacted the database/table, these empty record will now be removed and the space freed.

HTH
OK, I am at home now, not thinking about SQL, but 2morrow when I return to school, I will do exactly that!

thanx for the compacting tips. I`ll check it out.

My solution to the problem was creating a deletednumbers table that increases every time a row is deleted. The number which is inserted into the
deletednumbers table is id_number from the table i have deleted from. So if theres a number in deletednumbers, I know that I have open spaces there.

But thanks!

-b-