The below query shows the output of the transactions that are actively running on the Server.
SELECT sqltext.TEXT,
dm.session_id,
dm.status,
dm.command,
dm.cpu_time,
dm.total_elapsed_time
FROM sys.dm_exec_requests dm
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext
When we run the above query it shows the output what are the transactions that are running on the server. And it varies from time to time. As we refresh the query we will find the new query's executing on the server. This can be experienced when we run the query on the Production environment.
The same can be implemented on the stand-alone system i..e., personal computer where we schedule some jobs with SQL Script that inserts some information and some query's to retrieved the data.
Comments