SQLite重置主键字段

我有一些表在sqlite和我试图找出如何重置自动增量数据库字段。

我读到DELETE FROM tablename应该删除一切,并将自动递增字段重置为0,但是当我这样做它只是删除数据。当插入新记录时,autoincrement将在删除之前从中断处继续。

我的ident字段属性如下:

>字段类型:整数
>字段标志:PRIMARY KEY,AUTOINCREMENT,UNIQUE

是不是我在sqlite Maestro构建表,我在sqlite Maestro中执行DELETE语句?

任何帮助将是伟大的。

尝试这个:
delete from your_table;    
delete from sqlite_sequence where name='your_table';

SQLite Autoincrement

sqlite keeps track of the largest
ROWID that a table has ever held using
the special sqlITE_SEQUENCE table. The
sqlITE_SEQUENCE table is created and initialized automatically whenever a normal table that contains an AUTOINCREMENT column is created. The content of the sqlITE_SEQUENCE table can be modified using ordinary UPDATE,INSERT,and DELETE statements. But making modifications to this table will likely perturb the AUTOINCREMENT key generation algorithm. Make sure you know what you are doing before you undertake such changes.

相关文章

安装 在Windows上安装SQLite。 访问官网下载下Precompliled Binaries for Windows的两个压缩包。 创建s...
一、安装 下载地址:http://www.sqlite.org/download.html 将Precompiled Binaries for Windows下的包下...
实例: 会员信息管理 功能:1.查看数据库 2.清空数据库 3.增加会员 4.删除会员 5.更新会员 6.查找会员  ...
关于SQLite SQLite是一个轻量的、跨平台的、开源的数据库引擎,它的在读写效率、消耗总量、延迟时间和整...