Skip to content

Commit 63f9910

Browse files
committed
Optimized locking check
Turn it into dynamic SQL so that it works with earlier versions.
1 parent 1d06652 commit 63f9910

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

Install-All-Scripts.sql

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4943,6 +4943,7 @@ IF EXISTS (SELECT * FROM sys.all_columns WHERE name = 'is_optimized_locking_on'
49434943
BEGIN
49444944
IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 272) WITH NOWAIT;
49454945

4946+
SET @StringToExecute = N'
49464947
INSERT INTO [#BlitzResults]
49474948
( [CheckID] ,
49484949
[Priority] ,
@@ -4955,13 +4956,15 @@ IF EXISTS (SELECT * FROM sys.all_columns WHERE name = 'is_optimized_locking_on'
49554956
SELECT
49564957
272 AS [CheckID] ,
49574958
100 AS [Priority] ,
4958-
'Performance' AS [FindingsGroup] ,
4959-
'Optimized Locking Not Fully Set Up' AS [Finding] ,
4959+
''Performance'' AS [FindingsGroup] ,
4960+
''Optimized Locking Not Fully Set Up'' AS [Finding] ,
49604961
name,
4961-
'https://www.brentozar.com/go/optimizedlocking' AS [URL] ,
4962-
'RCSI should be enabled on this database to get the full benefits of optimized locking.' AS [Details]
4962+
''https://www.brentozar.com/go/optimizedlocking'' AS [URL] ,
4963+
''RCSI should be enabled on this database to get the full benefits of optimized locking.'' AS [Details]
49634964
FROM sys.databases
4964-
WHERE is_optimized_locking_on = 1 AND is_read_committed_snapshot_on = 0;
4965+
WHERE is_optimized_locking_on = 1 AND is_read_committed_snapshot_on = 0;'
4966+
4967+
EXEC(@StringToExecute);
49654968
END;
49664969

49674970
/* Check if target recovery interval <> 60 */

sp_Blitz.sql

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4943,6 +4943,7 @@ IF EXISTS (SELECT * FROM sys.all_columns WHERE name = 'is_optimized_locking_on'
49434943
BEGIN
49444944
IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 272) WITH NOWAIT;
49454945

4946+
SET @StringToExecute = N'
49464947
INSERT INTO [#BlitzResults]
49474948
( [CheckID] ,
49484949
[Priority] ,
@@ -4955,13 +4956,15 @@ IF EXISTS (SELECT * FROM sys.all_columns WHERE name = 'is_optimized_locking_on'
49554956
SELECT
49564957
272 AS [CheckID] ,
49574958
100 AS [Priority] ,
4958-
'Performance' AS [FindingsGroup] ,
4959-
'Optimized Locking Not Fully Set Up' AS [Finding] ,
4959+
''Performance'' AS [FindingsGroup] ,
4960+
''Optimized Locking Not Fully Set Up'' AS [Finding] ,
49604961
name,
4961-
'https://www.brentozar.com/go/optimizedlocking' AS [URL] ,
4962-
'RCSI should be enabled on this database to get the full benefits of optimized locking.' AS [Details]
4962+
''https://www.brentozar.com/go/optimizedlocking'' AS [URL] ,
4963+
''RCSI should be enabled on this database to get the full benefits of optimized locking.'' AS [Details]
49634964
FROM sys.databases
4964-
WHERE is_optimized_locking_on = 1 AND is_read_committed_snapshot_on = 0;
4965+
WHERE is_optimized_locking_on = 1 AND is_read_committed_snapshot_on = 0;'
4966+
4967+
EXEC(@StringToExecute);
49654968
END;
49664969

49674970
/* Check if target recovery interval <> 60 */

0 commit comments

Comments
 (0)