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.
___
"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
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
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
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
5 matches
Mail list logo