after i insert a record into my table, how can i retrieve the value of the new pk value (identity) that sql sever generated. ideally, i would like to accomplish this without having to use another query [example select Max(pk)]
Just a little warning about triggers:
If you insert to a table and generate a new Identity, but that insert fires a trigger that makes another insert on another table with an identity, the @@IDENTITY value you get back right after the first insert will actually be from the insert fired by the trigger.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.