but no effect on connection.
USE master
go
SELECT
sdes.session_id
,sdes.login_time
,sdes.last_request_start_time
,sdes.last_request_end_time
,sdes.is_user_process
,sdes.host_name
,sdes.program_name
,sdes.login_name
,sdes.status
,sdec.encrypt_option
,sdec.auth_scheme
,sdec.num_reads
,sdec.num_writes
,sdec.last_read
,sdec.last_write
,sdes.reads
,sdes.logical_reads
,sdes.writes
,sdest.DatabaseName
,sdest.ObjName
,sdes.client_interface_name
,sdes.nt_domain
,sdes.nt_user_name
,sdec.client_net_address
,sdec.local_net_address
,sdest.Query
FROM sys.dm_exec_sessions AS sdes
INNER JOIN sys.dm_exec_connections AS sdec
ON sdec.session_id = sdes.session_id
CROSS APPLY (
SELECT DB_NAME(dbid) AS DatabaseName
,OBJECT_NAME(objectid) AS ObjName
,COALESCE((
SELECT TEXT AS [processing-instruction(definition)]
FROM sys.dm_exec_sql_text(sdec.most_recent_sql_handle)
FOR XML PATH('')
,TYPE
), '') AS Query
FROM sys.dm_exec_sql_text(sdec.most_recent_sql_handle)
) sdest
WHERE sdes.session_id <> @@SPID;
Is it some bug or what is the right sintaxe?