diff --git a/BPCheck/Check_BP_Servers.sql b/BPCheck/Check_BP_Servers.sql index 2951cfbc..0894b3db 100644 --- a/BPCheck/Check_BP_Servers.sql +++ b/BPCheck/Check_BP_Servers.sql @@ -6377,7 +6377,7 @@ FROM sys.database_query_store_options;' SET isdone = 1 WHERE [dbid] = @dbid END - END + --END IF (SELECT COUNT([DBName]) FROM #tblQStoreInfo) > 0 BEGIN @@ -6391,7 +6391,7 @@ FROM sys.database_query_store_options;' SELECT 'Information' AS [Category], 'Query_Store' AS [Information] , '[INFORMATION: No databases have Query Store enabled]' AS [Comment]; END END; - +END; -------------------------------------------------------------------------------------------------------------------------------- -- Automatic Tuning info subsection -------------------------------------------------------------------------------------------------------------------------------- @@ -10491,14 +10491,16 @@ END; -------------------------------------------------------------------------------------------------------------------------------- IF @ptochecks = 1 BEGIN - RAISERROR (N' |-Starting Indexes with large keys (> 900 bytes)', 10, 1) WITH NOWAIT - IF (SELECT COUNT(*) FROM #tblIxs1 WHERE [KeyCols_data_length_bytes] > 900) > 0 + declare @MaxIndSize int=Case when @sqlmajorver >= 13 THEN 1700 else 900 End + declare @MaxIndSizeStr varchar(4)=Cast(@MaxIndSize as varchar(4)) + RAISERROR (N' |-Starting Indexes with large keys (> %s bytes)', 10, 1,@MaxIndSizeStr) WITH NOWAIT + IF (SELECT COUNT(*) FROM #tblIxs1 WHERE [KeyCols_data_length_bytes] > @MaxIndSize) > 0 BEGIN - SELECT 'Index_and_Stats_checks' AS [Category], 'Large_Index_Key' AS [Check], '[WARNING: Some indexes have keys larger than 900 bytes. It is recommended to revise these]' AS [Deviation] + SELECT 'Index_and_Stats_checks' AS [Category], 'Large_Index_Key' AS [Check], '[WARNING: Some indexes have keys larger than ' + @MaxIndSizeStr + ' bytes. It is recommended to revise these]' AS [Deviation] SELECT 'Index_and_Stats_checks' AS [Category], 'Large_Index_Key' AS [Information], I.[DatabaseName] AS [Database_Name], I.schemaName AS [Schema_Name], I.[objectName] AS [Table_Name], I.[indexID], I.[indexName] AS [Index_Name], I.KeyCols, [KeyCols_data_length_bytes] FROM #tblIxs1 I - WHERE [KeyCols_data_length_bytes] > 900 + WHERE [KeyCols_data_length_bytes] > @MaxIndSize ORDER BY I.[DatabaseName], I.schemaName, I.[objectName], I.[indexID] END ELSE