Re: [sqlite] Arranging of ids in Sqlite3

2008-12-01 Thread Alexey Pechnikov
Hello! В сообщении от Wednesday 26 November 2008 13:57:02 Nikhil Kansal написал(а): > But if I delete a chunk of data then how can I know the id number. You can get rowid for last inserted row as select last_insert_rowid(); Best regards, Alexey. ___

Re: [sqlite] Arranging of ids in Sqlite3

2008-11-26 Thread Igor Tandetnik
"Nikhil Kansal" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am using id as a integer primary key... > like > CREATE TABLE history( id INTEGER PRIMARY KEY, filename varchar NOT > NULL) now if i delete a entry from this table and add a entry again > then a id will be left blank

Re: [sqlite] Arranging of ids in Sqlite3

2008-11-26 Thread Nikhil Kansal
But if I delete a chunk of data then how can I know the id number. Nikhil On Wed, Nov 26, 2008 at 4:08 PM, Martin Engelschalk < [EMAIL PROTECTED]> wrote: > Hi, > > after a > delete from history where id = 15 > you could do a > update history set id = id - 1 where id > 15 > > However, it is not

Re: [sqlite] Arranging of ids in Sqlite3

2008-11-26 Thread Martin Engelschalk
Hi, after a delete from history where id = 15 you could do a update history set id = id - 1 where id > 15 However, it is not a good idea to change a primary key, especially if there are other data in other tables depending on it. Martin Nikhil Kansal wrote: > Hi, > > I am using id as a

[sqlite] Arranging of ids in Sqlite3

2008-11-26 Thread Nikhil Kansal
Hi, I am using id as a integer primary key... like CREATE TABLE history( id INTEGER PRIMARY KEY, filename varchar NOT NULL) now if i delete a entry from this table and add a entry again then a id will be left blank in between. Can we rearrange this ID. Regards, Nikhil