suppose i am calling a Stored Procedure and sending some params. the Stored Procedure will update a table and a trigger is there for that table. so when Stored Procedure update table then i want which user is updating the table but i am not using sql server user name rather i will send user names to SP who will update the table. so before update i can store that user name in local temp table and query that local temp table from trigger to get that user name. i hope it is possible but i want to other good option to achieve this job. so please share idea.
one guy told me
You can encode the user name in the procedure into the session using SET CONTEXT_INFO This can be read in the trigger by CONTEXT_INFO
This is concurrency safe: each session/call is isolated from any other.
And no need for a temp table or such.
DECLARE @context varbinary(100) = CAST('foobar' AS varbinary(100));
SET CONTEXT_INFO @context;
SELECT CAST(CONTEXT_INFO() AS varchar(100));
but CONTEXT_INFO is small data. suppose if i need to stored big data in store proc and want to access that data from trigger. how it will be possible........please guide. thanks