Groups > Databases > MySQL for ASP.NET > Re: how to get IDs after inserted to database




how to get IDs after inserted to database

how to get IDs after inserted to database
Sat, 8 Mar 2008 16:38:32 +0000
Hello,
in a store procedure I am using multiple inserts:
INSET into tableA (column1,column2)
SELECT a,b FROM ko

tableA(A_ID, column1,column2) where id is the auto number key of the table.

How can I retrieve the IDs that was inserted on tableA, inside the store
procedure?
Post Reply
Re: how to get IDs after inserted to database
Sat, 8 Mar 2008 17:16:43 +0000
Do SELECT SCOPE_IDENTITY after the INSERT statement
Post Reply
Re: how to get IDs after inserted to database
Sat, 8 Mar 2008 17:27:58 +0000
use this statement SELECT @@IDENTITY after insert statement   

 

if helpful please mark it as answer
Post Reply
Re: how to get IDs after inserted to database
Sat, 8 Mar 2008 17:53:15 +0000
@@IDENTITY and SCOPE_Identity() are TSQL (Microsoft SQL) functions which are
probably not implemented yet in MySQL.

Possibly MySQL is limited to a SELECT MAX(ID) immediatly after the Insert to get
the Id of the record just inserted.
Post Reply
Re: how to get IDs after inserted to database
Sat, 8 Mar 2008 18:33:17 +0000
If is about MySQL, the you can use SELECT LAST_INSERT_ID()
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact