Re: [sqlite] How to truncate table?
Dear Puneet Kishor, I never thought it does since I checked out the documentation of sqlite, it does not mention it. Greatly thanks for you very kind help! Cheers! Yours, Wilson Chan From: Puneet Kishor <[EMAIL PROTECTED]> Reply-To: sqlite-users@sqlite.org To: sqlite-users@sqlite.org Subject: Re: [sqlite] How to truncate table? Date: Wed, 20 Jul 2005 00:40:33 -0500 On Jul 20, 2005, at 12:33 AM, chan wilson wrote: Hi Puneet Kishor , Yes, you are right. I have to check out whether "DELETE FROM table;" will really set the auto imcrement primary key seed back zero. Yes, it will. Here you go -- sqlite> create table t (a integer primary key, b); sqlite> select * from t; sqlite> insert into t (b) values ('foo'); sqlite> insert into t (b) values ('bar'); sqlite> select * from t; 1|foo 2|bar sqlite> delete from t; sqlite> select * from t; sqlite> insert into t (b) values ('qux'); sqlite> insert into t (b) values ('baz'); sqlite> select * from t; 1|qux 2|baz sqlite> From: Puneet Kishor <[EMAIL PROTECTED]> Reply-To: sqlite-users@sqlite.org To: sqlite-users@sqlite.org Subject: Re: [sqlite] How to truncate table? Date: Wed, 20 Jul 2005 00:29:27 -0500 On Jul 19, 2005, at 11:50 PM, chan wilson wrote: Hi, In MS SQL, there is a "TRUNCATE TABLE" SQL that will remove all the records of a table and make the identity back to zero. Is there any means to accomplish it in sqlite? How about DELETE FROM table; I am assuming, by 'identity' you refer to the auto-incrementing primary key. If so, yes, SQLite will do the same thing. Fwiw, I believe TRUNCATE TABLE does a bit more than what you are implying above. It also truncates the logs and whatnot. But, that may be neither here nor there. -- Puneet Kishor _ [EMAIL PROTECTED];Aw#,Cb7QOBTX~} MSN Messenger: http://messenger.msn.com/cn -- Puneet Kishor _ 与世界各地的朋友进行交流,免费下载 MSN Messenger: http://messenger.msn.com/cn
Re: [sqlite] How to truncate table?
On Jul 20, 2005, at 12:33 AM, chan wilson wrote: Hi Puneet Kishor , Yes, you are right. I have to check out whether "DELETE FROM table;" will really set the auto imcrement primary key seed back zero. Yes, it will. Here you go -- sqlite> create table t (a integer primary key, b); sqlite> select * from t; sqlite> insert into t (b) values ('foo'); sqlite> insert into t (b) values ('bar'); sqlite> select * from t; 1|foo 2|bar sqlite> delete from t; sqlite> select * from t; sqlite> insert into t (b) values ('qux'); sqlite> insert into t (b) values ('baz'); sqlite> select * from t; 1|qux 2|baz sqlite> From: Puneet Kishor <[EMAIL PROTECTED]> Reply-To: sqlite-users@sqlite.org To: sqlite-users@sqlite.org Subject: Re: [sqlite] How to truncate table? Date: Wed, 20 Jul 2005 00:29:27 -0500 On Jul 19, 2005, at 11:50 PM, chan wilson wrote: Hi, In MS SQL, there is a "TRUNCATE TABLE" SQL that will remove all the records of a table and make the identity back to zero. Is there any means to accomplish it in sqlite? How about DELETE FROM table; I am assuming, by 'identity' you refer to the auto-incrementing primary key. If so, yes, SQLite will do the same thing. Fwiw, I believe TRUNCATE TABLE does a bit more than what you are implying above. It also truncates the logs and whatnot. But, that may be neither here nor there. -- Puneet Kishor _ [EMAIL PROTECTED];Aw#,Cb7QOBTX~} MSN Messenger: http://messenger.msn.com/cn -- Puneet Kishor
Re: [sqlite] How to truncate table?
Hi Puneet Kishor , Yes, you are right. I have to check out whether "DELETE FROM table;" will really set the auto imcrement primary key seed back zero. From: Puneet Kishor <[EMAIL PROTECTED]> Reply-To: sqlite-users@sqlite.org To: sqlite-users@sqlite.org Subject: Re: [sqlite] How to truncate table? Date: Wed, 20 Jul 2005 00:29:27 -0500 On Jul 19, 2005, at 11:50 PM, chan wilson wrote: Hi, In MS SQL, there is a "TRUNCATE TABLE" SQL that will remove all the records of a table and make the identity back to zero. Is there any means to accomplish it in sqlite? How about DELETE FROM table; I am assuming, by 'identity' you refer to the auto-incrementing primary key. If so, yes, SQLite will do the same thing. Fwiw, I believe TRUNCATE TABLE does a bit more than what you are implying above. It also truncates the logs and whatnot. But, that may be neither here nor there. -- Puneet Kishor _ 与世界各地的朋友进行交流,免费下载 MSN Messenger: http://messenger.msn.com/cn
Re: [sqlite] How to truncate table?
On Jul 19, 2005, at 11:50 PM, chan wilson wrote: Hi, In MS SQL, there is a "TRUNCATE TABLE" SQL that will remove all the records of a table and make the identity back to zero. Is there any means to accomplish it in sqlite? How about DELETE FROM table; I am assuming, by 'identity' you refer to the auto-incrementing primary key. If so, yes, SQLite will do the same thing. Fwiw, I believe TRUNCATE TABLE does a bit more than what you are implying above. It also truncates the logs and whatnot. But, that may be neither here nor there. -- Puneet Kishor
[sqlite] How to truncate table?
Hi, In MS SQL, there is a "TRUNCATE TABLE" SQL that will remove all the records of a table and make the identity back to zero. Is there any means to accomplish it in sqlite? Thanks! _ 与世界各地的朋友进行交流,免费下载 MSN Messenger: http://messenger.msn.com/cn