Link to home
Start Free TrialLog in
Avatar of HLRosenberger
HLRosenbergerFlag for United States of America

asked on

Help with "SELECT @@Identity"

I use "SELECT @@Identity" to return back the Identity column (primary key) after an insert.   I'm hitting a issue - a table on which I'm doing the INSERT has a trigger that itself causes an INSERT into another table.  So, SELECT @@Identity, which "returns the last-inserted identity value" is returning the identity value for the record inserted by trigger, which is not what I want.  

Is there a way around this?
SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of HLRosenberger

ASKER

thanks!!