title: How to store UserName who is Updating the value of a table in For Update Trigger?
body: <p>In my web application, am creating a log process. I have created an update trigger, its working perfectly but I need to know who updated this data i.e the user who performed this action.</p>
  
  <p>I have googled it and asking to use context_info. What does it mean?</p>
  
  <p><strong>How to store this information in trigger table?</strong></p>
  
  <p>This is my procedure.. i have used your concept..</p>
  
  <pre><code>ALTER Procedure [dbo].[MIS_CompOffDate]   
  (  
  @EmpId nvarchar(20), 
  
  @UserName nvarchar(50),
  
  @ActualDate datetime,
  
  @DayName nvarchar(20),
  
  @CompOffDate datetime 
  
  )  
  
  As
  
  Begin 
  
  DECLARE @UserNameConverted VARBINARY(128) = CONVERT(VARBINARY(128), @EmpId);
  
  SET CONTEXT_INFO @UserNameConverted;  
  
  INSERT INTO MIS_BM_CompOff values(@EmpId, @UserName, @ActualDate, @DayName, @CompOffDate)
  
  End
  </code></pre>
  
  <p>In the empid-the user's empid is there...</p>