Any way to get auto_increment number immediately after creating a row?
Edit: Nevermind. I figured this out.
Last edited by evenstar7139; 01-28-2013 at 07:16 PM.
How about sharing your solution for future searches?
Here's a solution for SQL Server:
sql = "insert into table(row) values(value) SELECT @@IDENTITY"
Set rs = Conn.Execute(sql).NextRecordSet
NewID = rs(0)
MySQL has a last_insert_id function (for which PHP has a corresponding function, by the way).
PostgreSQL (and perhaps other DBMS's?) has a RETURNING clause you can use with an insert:
INSERT . . . RETURNING table_key_field
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)