I have a table where I created an INSTEAD OF trigger to enforce some business rules.
The issue is that when I insert data into this table, SCOPE_I
Use @@identity instead of scope_identity().
While scope_identity() returns the last created id in the current scope, @@identity returns the last created id in the current session.
The scope_identity() function is normally recommended over the @@identity field, as you usually don't want triggers to interfer with the id, but in this case you do.