if you insert something using a stored procedure, you should use SELECT SCOPE_IDENTITY (), which will return the last authentication value created in the current session, but it will also limit it to the current scope. With this use, you will not get the last inserted identifier that could be triggered by the trigger.
Keep this in mind if you will use the result for an insert operation inside the same or called procedure.
Senib source
share