Resetting Autoincrement in Android SQLite

前端 未结 4 1738
隐瞒了意图╮
隐瞒了意图╮ 2020-12-31 10:53

I have this method which will remove all rows from a table but I also want it to reset the autoincrement so that when a new row is added it will start again. The SQL stateme

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-31 11:48

    you'll need single quotes around your table name, i.e.

    db.execSQL("DELETE FROM SQLITE_SEQUENCE WHERE NAME = '" + TABLE_NAME + "'");
    

提交回复
热议问题