What queries should you run to debug what are the stored procedures that caused a deadlock and on what line I should look at on MSSQL?



  • What queries should you run to debug what are the stored procedures that caused a deadlock and on what line I should look at on MSSQL? I am trying to fix a recurring deadlock on MSSQL. The issue is I am not sure what queries I should run to get all the information I need.



  • You can add code to the stored procedures to output progress to the Messages window as each step starts and completes.

    DECLARE @strStatus VARCHAR(200);
    SET @strStatus = CONVERT(VARCHAR(30), GETDATE()) + ' Starting sp1...';
    RAISERROR (@strStatus, 10, 1) WITH NOWAIT;
    

    EXEC sp1

    SET @strStatus = CONVERT(VARCHAR(30), GETDATE()) + ' Finished sp1...';
    RAISERROR (@strStatus, 10, 1) WITH NOWAIT;




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2