Ultimul query rulat

Configurare noua (How To)

Situatie

Mai jos este o procedura care returneaza pentru sesiunile active, de pe un server Microsoft SQL Server, ultimul query rulat de fiecare dintre aceste sesiuni.

Solutie

alter procedure UltimulQueryRulat
as
SELECT
c.session_id,
s.host_name,
s.login_name,
s.status,
    st.text,
s.login_time,
s.program_name
FROM sys.dm_exec_connections c
INNER JOIN sys.dm_exec_sessions s ON c.session_id = s.session_id
CROSS APPLY sys.dm_exec_sql_text(most_recent_sql_handle) AS st
ORDER BY c.session_id

Tip solutie

Permanent
Etichetare:

Voteaza

(8 din 18 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?