Skip to content

Commit

Permalink
Merge pull request #3576 from BrentOzarULTD/3566_sp_BlitzLock_error
Browse files Browse the repository at this point in the history
#3566 sp_BlitzLock better qualify synonym
  • Loading branch information
BrentOzar authored Oct 14, 2024
2 parents abcc94d + 156fa58 commit ae935df
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions sp_BlitzLock.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3675,8 +3675,9 @@ BEGIN
SET STATISTICS XML ON;
END;

INSERT INTO
DeadLockTbl
SET @StringToExecute = N'
INSERT INTO ' + QUOTENAME(DB_NAME()) + N'..DeadLockTbl
(
ServerName,
deadlock_type,
Expand Down Expand Up @@ -3720,7 +3721,8 @@ BEGIN
deadlock_graph
)
EXEC sys.sp_executesql
@deadlock_result;
@deadlock_result;'
EXEC sys.sp_executesql @StringToExecute, N'@deadlock_result NVARCHAR(MAX)', @deadlock_result;

IF @Debug = 1
BEGIN
Expand All @@ -3734,8 +3736,9 @@ BEGIN
SET @d = CONVERT(varchar(40), GETDATE(), 109);
RAISERROR('Findings to table %s', 0, 1, @d) WITH NOWAIT;

INSERT INTO
DeadlockFindings
SET @StringToExecute = N'
INSERT INTO ' + QUOTENAME(DB_NAME()) + N'..DeadlockFindings
(
ServerName,
check_id,
Expand All @@ -3753,7 +3756,8 @@ BEGIN
df.finding
FROM #deadlock_findings AS df
ORDER BY df.check_id
OPTION(RECOMPILE);
OPTION(RECOMPILE);'
EXEC sys.sp_executesql @StringToExecute;

RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;

Expand Down

0 comments on commit ae935df

Please sign in to comment.