title: What is the scope of CONTEXT_INFO in SQL Server?
body: <p>I am using CONTEXT_INFO to pass a username to a delete trigger for the purposes of an audit/history table.  I'm trying to understand the scope of CONTEXT_INFO and if I am creating a potential race condition.</p>
  
  <p>Each of my database tables has a stored proc to handle deletes.  The delete stored proc takes userId as an parameter, and sets CONTEXT_INFO to the userId.  My delete trigger then grabs the CONTEXT_INFO and uses that to update an audit table that indicates who deleted the row(s).</p>
  
  <p>The question is, if two deletes sprocs from different users are executing at the same time, can CONTEXT_INFO set in one of the sprocs be consumed by the trigger fired by the other sproc?</p>
  
  <p>I've seen this article <a href="http://msdn.microsoft.com/en-us/library/ms189252.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms189252.aspx</a> but I'm not clear on the scope of sessions and batches in SQL Server which is key to the article being helpful!</p>
  
  <p>I'd post code, but short on time at the moment.  I'll edit later if this isn't clear enough.</p>
  
  <p>Thanks in advance for any help.</p>