On 3/18/08, A.J.Millan <[EMAIL PROTECTED]> wrote:
> From: "P Kishor" <[EMAIL PROTECTED]>
>
>
>  >>  I would know if there a some way to know the last insert in a know
>  >> table.
>  >>
>  >>  Some like the result returned by  sqlite3_last_insert_rowid(), but
>  >> referred
>  >>  to a specific table inside the database connection, and not in all
>  >> tables
>  >>  into the database from the database connection.
>  >
>
> > last_insert_rowid() is indeed the result of the insert into a
>  > *specific* table, the one that happens to have a row inserted at the
>  > very last! You can't possibly insert the "last" row in *all* the
>  > tables just like you can't take away the last coach from a train... no
>  > matter what you take away, there will always be a last one.
>  >
>  > When the *next* insert operation happens, the result of that insert
>  > will become the last insert.
>
>
>
> Puneet:
>
>  Thanks for your reply, but let me be a bit more concise.
>
>  I need update several tables in a dBase, and after all, I need to know the
>  las insert id of one, or several of them.
>
>  Odviously I can keep a variable with the last_insert_rowid() of each
>  specific table, obtained inmediately after the update of the table/s of my
>  interest, but I try avoid global variables, so my question.
>
>  Thanks anyway.
>
>
>  A.J.Millan
>
>


Dennis Cote offered the most elegant and concise solution, that of
creating a new table to keep track of the last row inserted in each
table. Something that I also envision I can use in certain
circumstances.

Puneet.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to