Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions sp_BlitzCache.sql
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ ALTER PROCEDURE dbo.sp_BlitzCache
@MinutesBack INT = NULL,
@Version VARCHAR(30) = NULL OUTPUT,
@VersionDate DATETIME = NULL OUTPUT,
@VersionCheckMode BIT = 0
@VersionCheckMode BIT = 0,
@KeepCRLF BIT = 0
WITH RECOMPILE
AS
BEGIN
Expand Down Expand Up @@ -483,7 +484,12 @@ IF @Help = 1
UNION ALL
SELECT N'@VersionCheckMode',
N'BIT',
N'Setting this to 1 will make the procedure stop after setting @Version and @VersionDate.';
N'Setting this to 1 will make the procedure stop after setting @Version and @VersionDate.'

UNION ALL
SELECT N'@KeepCRLF',
N'BIT',
N'Retain CR/LF in query text to avoid issues caused by line comments.';


/* Column definitions */
Expand Down Expand Up @@ -2760,7 +2766,10 @@ SET PercentCPU = y.PercentCPU,
/* Strip newlines and tabs. Tabs are replaced with multiple spaces
so that the later whitespace trim will completely eliminate them
*/
QueryText = REPLACE(REPLACE(REPLACE(QueryText, @cr, ' '), @lf, ' '), @tab, ' ')
QueryText = CASE WHEN @KeepCRLF = 1
THEN REPLACE(QueryText, @tab, ' ')
ELSE REPLACE(REPLACE(REPLACE(QueryText, @cr, ' '), @lf, ' '), @tab, ' ')
END
FROM (
SELECT PlanHandle,
CASE @total_cpu WHEN 0 THEN 0
Expand Down Expand Up @@ -2816,7 +2825,10 @@ SET PercentCPU = y.PercentCPU,
/* Strip newlines and tabs. Tabs are replaced with multiple spaces
so that the later whitespace trim will completely eliminate them
*/
QueryText = REPLACE(REPLACE(REPLACE(QueryText, @cr, ' '), @lf, ' '), @tab, ' ')
QueryText = CASE WHEN @KeepCRLF = 1
THEN REPLACE(QueryText, @tab, ' ')
ELSE REPLACE(REPLACE(REPLACE(QueryText, @cr, ' '), @lf, ' '), @tab, ' ')
END
FROM (
SELECT DatabaseName,
SqlHandle,
Expand Down
Loading