2

I am working with SQL Server 2008 R2. If I set some context info for the current session, how can I track it in SQL Server Profiler? Which column in SQL Server Profiler will show me the value of the context info?

For example suppose in a stored procedure, I set context info to 'dev_support' this way:

declare @v_user_id varchar(100)
declare @v_context_info varbinary(128)

select @v_user_id = 'dev_support'
select @v_context_info = CONVERT(varbinary(128), @v_user_id)
SET CONTEXT_INFO @v_context_info

How to see the value 'dev_support' in SQL Server Profile?

Thanks

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
srh
  • 1,661
  • 4
  • 30
  • 57
  • I don't see it listed as an available column https://msdn.microsoft.com/en-us/library/ms186265.aspx. It is available in extended events but only from 2012 http://sqlblog.com/blogs/jonathan_kehayias/archive/2010/12/01/an-xevent-a-day-1-31-an-overview-of-extended-events.aspx – Martin Smith Aug 11 '15 at 20:05
  • @MartinSmith can you make your comment an answer? – srh Aug 21 '15 at 14:25
  • Maybe you could use custom application name in the connection string if it solves your original problem - https://stackoverflow.com/questions/25581002/how-to-add-custom-attributes-to-sql-connection-string – sparrow Feb 08 '18 at 16:17

0 Answers0