2011年12月16日 星期五

[SQLite] Truncate table

In SQL server or mysql, you can delete all data from a table and set auto-increment identity to zero by the command below:

TRUNCATE TABLE [TableName];

In SQLite, there is no command for truncate tables, you should remove data and set identity by yourself.

DELETE FROM  [TableName]; 
UPDATE sqlite_sequence SET seq=0 WHERE name=' TableName'; 

沒有留言:

張貼留言