Date |Tue, 28 Aug 2001 12:49:52 +0100
>From |[EMAIL PROTECTED]

Hello!

S> When you have just inserted a record into a table that autoincrements the
S> primary key,
S> is there a way of retrieving the id assigned at the same time? I'm using ASP
S> to write the 
S> code in question , and I'm trying to find a better solution that looking at
S> the max key value
S> just before/after in code, and praying no other query was run at the same
S> time. Does mysql
S> have any  feature to accomadate this?

You can use LAST_INSERT_ID() function for it.
Read for example here 
http://www.mysql.com/doc/G/e/Getting_unique_ID.html
___________________________________________________________________
For technical support contracts, visit https://order.mysql.com/
This email is sponsored by SWSoft, http://www.asplinux.ru/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Grigory Bakunov <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB / SWSoft
/_/  /_/\_, /___/\___\_\___/
       <___/   www.mysql.com


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to