I have one SQLite table. I want it to store only 1000 rows maximum.
If a new record comes aftre that limit, then it should automatically delete the last row before inserting the new one.
Is there any way to achieve this?
I have one SQLite table. I want it to store only 1000 rows maximum.
If a new record comes aftre that limit, then it should automatically delete the last row before inserting the new one.
Is there any way to achieve this?
Check before you insert
Your command should be like this...
if ((select count(*) from yourTable)=1000)
delete from yourTable where id= (select max(id) from yourTable)
insert into yourTable values(@values...)
else
insert into yourTable values(@values...)