I have a SQL table that has a primary key (Row_id) that has a format like:
110001
110002
110003
...
This table may be updated by removing some rows over time. I have a php script and want to have it insert new rows to first available position not just to increase the last existing id.
for example if I have this:
110001
110002
110004
110005
I want to new row be inserted and given the id = 110003 not 110006.
any help would be appreciated!
Don’t know why you want to reuse id(s) but, here we go
Suppose that you’re table name is
Tbl:this should works for retrieve the id that you want.
After that, obviously, you have to do an insert based on the previous value.
So