Skip to content

Commit e7c2ecb

Browse files
Update sp_BlitzLock.sql
Closes #3276
1 parent 904688e commit e7c2ecb

1 file changed

Lines changed: 34 additions & 32 deletions

File tree

sp_BlitzLock.sql

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3538,38 +3538,40 @@ BEGIN
35383538
DROP SYNONYM DeadlockFindings; /*done with inserting.*/
35393539
END;
35403540
ELSE /*Output to database is not set output to client app*/
3541-
SET @d = CONVERT(varchar(40), GETDATE(), 109);
3542-
RAISERROR('Results to client %s', 0, 1, @d) WITH NOWAIT;
3543-
3544-
IF @Debug = 1 BEGIN SET STATISTICS XML ON; END;
3545-
3546-
EXEC sys.sp_executesql
3547-
@deadlock_result;
3548-
3549-
IF @Debug = 1
3550-
BEGIN
3551-
SET STATISTICS XML OFF;
3552-
PRINT @deadlock_result;
3553-
END;
3554-
3555-
RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;
3556-
3557-
SET @d = CONVERT(varchar(40), GETDATE(), 109);
3558-
RAISERROR('Returning findings %s', 0, 1, @d) WITH NOWAIT;
3559-
3560-
SELECT
3561-
df.check_id,
3562-
df.database_name,
3563-
df.object_name,
3564-
df.finding_group,
3565-
df.finding
3566-
FROM #deadlock_findings AS df
3567-
ORDER BY df.check_id
3568-
OPTION(RECOMPILE);
3569-
3570-
SET @d = CONVERT(varchar(40), GETDATE(), 109);
3571-
RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;
3572-
END; /*done with output to client app.*/
3541+
BEGIN
3542+
SET @d = CONVERT(varchar(40), GETDATE(), 109);
3543+
RAISERROR('Results to client %s', 0, 1, @d) WITH NOWAIT;
3544+
3545+
IF @Debug = 1 BEGIN SET STATISTICS XML ON; END;
3546+
3547+
EXEC sys.sp_executesql
3548+
@deadlock_result;
3549+
3550+
IF @Debug = 1
3551+
BEGIN
3552+
SET STATISTICS XML OFF;
3553+
PRINT @deadlock_result;
3554+
END;
3555+
3556+
RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;
3557+
3558+
SET @d = CONVERT(varchar(40), GETDATE(), 109);
3559+
RAISERROR('Returning findings %s', 0, 1, @d) WITH NOWAIT;
3560+
3561+
SELECT
3562+
df.check_id,
3563+
df.database_name,
3564+
df.object_name,
3565+
df.finding_group,
3566+
df.finding
3567+
FROM #deadlock_findings AS df
3568+
ORDER BY df.check_id
3569+
OPTION(RECOMPILE);
3570+
3571+
SET @d = CONVERT(varchar(40), GETDATE(), 109);
3572+
RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;
3573+
END; /*done with output to client app.*/
3574+
END;
35733575

35743576
IF @Debug = 1
35753577
BEGIN

0 commit comments

Comments
 (0)