Convert MySQL LAST_INSERT_ID() to MSSQL 2005
I'm converting an ASP site that is using MySQL to run on MSSQL 2005.
On some pages, after a new record has been created, I need the ID (primary key) of the newly created record to pass as a querystring to the next page (for various reasons). Currently I use the MySQL LAST_INSERT_ID() to grab the last entered "ID" immediately after the INSERT code. The Last_Insert_ID() code looks like this:
and assigns the last auto-increment ID to the variable "tmpmemId".
Set rs1 = Server.CreateObject("ADODB.Recordset")
rs1.Open "SELECT LAST_INSERT_ID()", dbconn
tmpmemId = rs1(0)
Is there an equivilant function in MSSQL 2005 that will achieve the same result?
Hope someone can help.