Skip to main content

Posts

Showing posts from February, 2019

SQL Server Setting Session Information

Oracle has a functionality to set information to an application or user session using  DBMS_APPLICATION_INFO . On Microsoft SQL a similar functionality can be achieved using  dm_exec_requests context_info field. To set that information use: DECLARE @Info BINARY(128) = CAST('XYZ Session' AS BINARY(128)) SET CONTEXT_INFO @Info When querying dm_exec_requests you can see the information you set on the session select CAST(req.context_info AS VARCHAR(128)) as char_context_info, session_id, start_time, status, command FROM sys.dm_exec_requests req XYZ Session,90,2019-02-14 10:03:48.140,running,SELECT