I have a procedure that is doing INSERT/DELETE operations over table and a trigger which is logging the changes in second table.
What I need is to pass the security user id that instantiated the procedure call to the trigger in order to record who user has made the changes.
It seems that the only way to do this is to use SET CONTEXT_INFO and CONTEXT_INFO().
The issue is, I am not able to extract the number(the user id). For example, the code below:
SET CONTEXT_INFO 10001
GO
SELECT CAST(CONTEXT_INFO() AS INT)
returns 0.