Skip to content

Commit

Permalink
Merge pull request #36 from SQLozano/main
Browse files Browse the repository at this point in the history
Fix for ServerTopQueries on SQL 2016
  • Loading branch information
SQLozano authored Dec 14, 2023
2 parents 30ee48b + 4de5008 commit 115f671
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ServerTopQueries/5-dbo.ServerTopQueries.Procedure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
-- Date: 2022.10.18
-- Auth: Pablo Lozano (@sqlozano)
-- Changes: Fixed bug ocurring when some metrics caused a divide by zero error with @Percentages = 1
--
-- Date: 2023.12.14
-- Auth: Pablo Lozano (@sqlozano)
-- Changes: Fixed bug ocurring when running on SQL 2016 due to metrics defaulting to NULL rather than 0
----------------------------------------------------------------------------------

CREATE OR ALTER PROCEDURE [dbo].[ServerTopQueries]
Expand Down Expand Up @@ -359,7 +363,7 @@ FROM [st2]
-- If the SQL version is 2016, exclude components not available on that version - START
IF (@Version = 13)
BEGIN
SET @SqlCommand2PopulateTempTableTemplate = REPLACE(@SqlCommand2PopulateTempTableTemplate, '{@SQL2016columns}', 'NULL --')
SET @SqlCommand2PopulateTempTableTemplate = REPLACE(@SqlCommand2PopulateTempTableTemplate, '{@SQL2016columns}', '0 --')
END
ELSE
BEGIN
Expand Down

0 comments on commit 115f671

Please sign in to comment.