当SQLite数据库中包含自增列时,会自动建立一个名为 sqlite_sequence 的表.这个表包含两个列:name和seq.name记录自增列所在的表,seq记录当前序号(下一条记录的编号就是当前序号加1).如果想把某个自增列的序号归零,只需要修改 sqlite_sequence表就可以了.UPDATE sqlite_sequence SET seq = 0 WHERE name='TableName';也可以直接把该记录删掉: DELETE FROM sqlite_sequence WH…
SQL语句获取数据库中的表主键,自增列,所有列 获取表主键 1:SELECT TABLE_NAME,COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGEWHERE TABLE_NAME<>'dtproperties' 2:EXEC sp_pkeys @table_name='表名' 3: select o.name as 表名,c.name as 字段名,k.colid as 字段序号,k.keyno as 索引顺序,t.name as…