faqts : Computers : Programming : Languages : PHP : Database Backed Sites : ODBC

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

20 of 34 people (59%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

How do I know the last AUTOINCREMENT ID of a inserted record in a ODBC or MSSQL database? (equiv. MySQL_insertid)

Sep 16th, 2000 23:43
John Lim, Fernando Moreira,


You perform the following sql command after your insert.
   SELECT @@IDENTITY
Note that if you are using persistent connections, or ODBC connection 
pooling, you might need to wrap the insert and select in a transaction.