android - How to reset/reuse deleted row id instead of MAX(id) in sqlite -


i have table in sqlite namely table_a. it's 1 of column 'id' set auto increment. have 5 rows ids 0,1,2,3,4. deleted rows id 2 & 3. when add 3 rows id auto generated 5,6,7. want should use deleted row id i.e 2 , use 3 use 5. idea how can done.

this may work you

select id + 1 tablename t1 not exists (select 1 tablename t2 t2.id = t1.id + 1) limit 0,1 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -