My normal process for inserting into one table and then getting the ID back so that I can insert into another table is like this in MSSQL:
DECLARE @transacti
For MSSQL both of the following will return the new primary key
OR