Skip to content

Commit 4747a47

Browse files
Fix 5 additional issues found in round 2 review
- sp_HealthParser: Add missing N'' prefix on dynamic SQL string (line 435) - sp_HumanEventsBlockViewer: Fix debug label '#blocking_sh' → '#blocking_xml_sh' - sp_PerfCheck: GETDATE() → SYSDATETIME() for uptime calculation consistency - sp_PressureDetector: Rename misleading 'physical_reads' column to 'logical_reads' (source was der.logical_reads, not der.reads) - sp_PressureDetector: Fix SUBSTRING start position 0 → 1 in debug PRINT All 10 procedures tested on SQL2022. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f6f0778 commit 4747a47

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

sp_HealthParser/sp_HealthParser.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ AND ca.utc_timestamp < @end_date';
432432
SET @time_filter = N'
433433
AND CONVERT(datetimeoffset(7), fx.timestamp_utc) BETWEEN @start_date AND @end_date';
434434
ELSE
435-
SET @time_filter = '
435+
SET @time_filter = N'
436436
AND fx.timestamp_utc BETWEEN @start_date AND @end_date';
437437
END;
438438

sp_HumanEvents/sp_HumanEventsBlockViewer.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ BEGIN
13561356
IF @debug = 1
13571357
BEGIN
13581358
SELECT
1359-
table_name = '#blocking_sh',
1359+
table_name = '#blocking_xml_sh',
13601360
bxs.*
13611361
FROM #blocking_xml_sh AS bxs
13621362
OPTION(RECOMPILE);

sp_PerfCheck/sp_PerfCheck.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2058,11 +2058,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20582058
END
20592059
),
20602060
@server_uptime_hours =
2061-
DATEDIFF(SECOND, osi.sqlserver_start_time, GETDATE()) / 3600.0
2061+
DATEDIFF(SECOND, osi.sqlserver_start_time, SYSDATETIME()) / 3600.0
20622062
FROM sys.dm_os_wait_stats AS osw
20632063
CROSS JOIN sys.dm_os_sys_info AS osi
20642064
GROUP BY
2065-
DATEDIFF(SECOND, osi.sqlserver_start_time, GETDATE()) / 3600.0;
2065+
DATEDIFF(SECOND, osi.sqlserver_start_time, SYSDATETIME()) / 3600.0;
20662066

20672067
SET @pagelatch_ratio_to_uptime =
20682068
@pagelatch_wait_hours / NULLIF(@server_uptime_hours, 0) * 100;

sp_PressureDetector/sp_PressureDetector.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3964,7 +3964,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
39643964

39653965
IF @debug = 1
39663966
BEGIN
3967-
PRINT SUBSTRING(@cpu_sql, 0, 4000);
3967+
PRINT SUBSTRING(@cpu_sql, 1, 4000);
39683968
PRINT SUBSTRING(@cpu_sql, 4001, 8000);
39693969
END;
39703970

@@ -4319,7 +4319,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
43194319
bi.wait_resource,
43204320
reads = ISNULL(der.reads, 0),
43214321
writes = ISNULL(der.writes, 0),
4322-
physical_reads = ISNULL(der.logical_reads, bi.physical_io),
4322+
logical_reads = ISNULL(der.logical_reads, bi.physical_io),
43234323
cpu_time = ISNULL(der.cpu_time, bi.cpu_time),
43244324
used_memory = ISNULL(der.granted_query_memory, bi.memusage),
43254325
bi.status,

0 commit comments

Comments
 (0)