Click here to Skip to main content
15,560,678 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I work on sql server 2014
How to write query get long process job or query or stored procedure running on server ?

as example suppose i run
exec sp_joblong
how to know this procedure running now
and which place it stop and take long time
and how to know it finish execution on server

What I have tried:

suppose i run exec sp_joblong
how to know level of query or process as (start-progress-finish)
Updated 6-Jan-22 17:46pm

1 solution

Status of each session can be found from sys.dm_exec_requests (Transact-SQL) - SQL Server | Microsoft Docs[^]
The status column helps you to see current status of the session, is a query running or not.

The query can be found using sys.dm_exec_sql_text (Transact-SQL) - SQL Server | Microsoft Docs[^]. In the examples you can find queries to fetch data from currently running sessions.

In general, to stop a query, you need to kill the session using KILL (Transact-SQL) - SQL Server | Microsoft Docs[^].
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900