Link to home
Start Free TrialLog in
Avatar of Bharat Guru
Bharat Guru

asked on

Storeced procedure hangs

Once in a while the stored procedure hangs, How can I find which statement from stored procedure is timing out or making the SQL hang while process is hang.

sp_who2  can find the process ID but Is there any way I can find which statement within the stored procedure makes whole stored procedure hangs?
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of HugoHiasl
HugoHiasl

Another way is to use PRINT('text')  statements and run the stored procedure in SQL Management studio. In the "Messages" tab you can see what PRINT statement was executed last when it hangs.
Start a SQL Profiler just before you run the SP again and capture and single SQL Statements. You'll see which one is originating the issue.
Avatar of Bharat Guru

ASKER

Thanks