File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -3675,8 +3675,9 @@ BEGIN
3675
3675
SET STATISTICS XML ON ;
3676
3676
END;
3677
3677
3678
- INSERT INTO
3679
- DeadLockTbl
3678
+ SET @StringToExecute = N'
3679
+
3680
+ INSERT INTO ' + QUOTENAME(DB_NAME()) + N' ..DeadLockTbl
3680
3681
(
3681
3682
ServerName,
3682
3683
deadlock_type,
@@ -3720,7 +3721,8 @@ BEGIN
3720
3721
deadlock_graph
3721
3722
)
3722
3723
EXEC sys.sp_executesql
3723
- @deadlock_result;
3724
+ @deadlock_result;'
3725
+ EXEC sys .sp_executesql @StringToExecute, N' @deadlock_result NVARCHAR(MAX)' , @deadlock_result;
3724
3726
3725
3727
IF @Debug = 1
3726
3728
BEGIN
@@ -3734,8 +3736,9 @@ BEGIN
3734
3736
SET @d = CONVERT (varchar (40 ), GETDATE(), 109 );
3735
3737
RAISERROR(' Findings to table %s' , 0 , 1 , @d) WITH NOWAIT;
3736
3738
3737
- INSERT INTO
3738
- DeadlockFindings
3739
+ SET @StringToExecute = N'
3740
+
3741
+ INSERT INTO ' + QUOTENAME(DB_NAME()) + N' ..DeadlockFindings
3739
3742
(
3740
3743
ServerName,
3741
3744
check_id,
@@ -3753,7 +3756,8 @@ BEGIN
3753
3756
df.finding
3754
3757
FROM #deadlock_findings AS df
3755
3758
ORDER BY df.check_id
3756
- OPTION(RECOMPILE);
3759
+ OPTION(RECOMPILE);'
3760
+ EXEC sys .sp_executesql @StringToExecute;
3757
3761
3758
3762
RAISERROR(' Finished at %s' , 0 , 1 , @d) WITH NOWAIT;
3759
3763
You can’t perform that action at this time.
0 commit comments