Technical Article

Quick check SQL connection and process details with current SQL text

,

Step 1: Create the view

Step 2: Join with sys.sysdatabases and check the connection details

create view sqlexec as
SELECT
s.spid,s.dbid,s.login_time,s.hostname, s.loginame, s.program_name,s.waittype,s.lastwaittype,s.cmd,s.blocked,s.cpu,s.memusage,s.physical_io,s.status,s.net_library,s.sql_handle
,e.text as SQL
FROM 
sys.sysprocesses s
CROSS APPLY sys.dm_exec_sql_text(s.sql_handle) AS e

select d.name,s.* from sqlexec s,sys.sysdatabases d where s.dbid=d.dbid order by login_time desc

Rate

3.75 (4)

You rated this post out of 5. Change rating

Share

Share

Rate

3.75 (4)

You rated this post out of 5. Change rating