I want to capture the user’s name who deletes a row, when delete action is taken then a stored procedure deletes a row from table. We are providing all required parameters to the stored procedure and also the user’s name from the front end who is deleting data.
Basically I want to capture the user’s name who is deleting from stored procedure from delete trigger. But it is not possible. We can do one thing that before deleting record we can put the user’s name into a temp table and get that name from trigger. But there is one problem that at a time two users can delete two different rows. So what will be the best solution? I don’t want use any shadow tables. please discuss. thanks
You are basically asking how to pass the parameter into the trigger?
You can use set
CONTEXT_INFOinside the procedure and read this inside the trigger.