Skip to content

Commit 5b17056

Browse files
authored
Merge pull request BrentOzarULTD#1330 from BrentOzarULTD/Issue_1329
Fixes BrentOzarULTD#1329
2 parents 0eef379 + 275cbe2 commit 5b17056

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

sp_BlitzCache.sql

+3-2
Original file line numberDiff line numberDiff line change
@@ -3199,7 +3199,6 @@ WHERE NOT EXISTS
31993199
FROM #stored_proc_info AS sp
32003200
WHERE (sp.proc_name = 'adhoc' AND sp.QueryHash = vi.QueryHash)
32013201
OR (sp.proc_name <> 'adhoc' AND sp.SqlHandle = vi.SqlHandle)
3202-
AND sp.variable_name = vi.variable_name
32033202
)
32043203
OPTION ( RECOMPILE );
32053204

@@ -3221,7 +3220,9 @@ SET s.variable_datatype = CASE WHEN s.variable_datatype LIKE '%(%)%' THEN
32213220
- CHARINDEX('(', s.compile_time_value)
32223221
)
32233222
WHEN variable_datatype NOT IN ('bit', 'tinyint', 'smallint', 'int', 'bigint')
3224-
AND s.variable_datatype NOT LIKE '%binary%' THEN
3223+
AND s.variable_datatype NOT LIKE '%binary%'
3224+
AND s.compile_time_value NOT LIKE 'N''%'''
3225+
AND s.compile_time_value NOT LIKE '''%''' THEN
32253226
QUOTENAME(compile_time_value, '''')
32263227
ELSE s.compile_time_value
32273228
END

sp_BlitzQueryStore.sql

+5-4
Original file line numberDiff line numberDiff line change
@@ -3057,7 +3057,6 @@ IF EXISTS ( SELECT 1
30573057
FROM #stored_proc_info AS sp
30583058
WHERE (sp.proc_name = 'adhoc' AND sp.query_hash = vi.query_hash)
30593059
OR (sp.proc_name <> 'adhoc' AND sp.sql_handle = vi.sql_handle)
3060-
AND sp.variable_name = vi.variable_name
30613060
)
30623061
OPTION ( RECOMPILE );
30633062

@@ -3078,9 +3077,11 @@ IF EXISTS ( SELECT 1
30783077
- CHARINDEX('(', s.compile_time_value)
30793078
)
30803079
WHEN variable_datatype NOT IN ('bit', 'tinyint', 'smallint', 'int', 'bigint')
3081-
AND s.variable_datatype NOT LIKE '%binary%' THEN
3082-
QUOTENAME(compile_time_value, '''')
3083-
ELSE s.compile_time_value
3080+
AND s.variable_datatype NOT LIKE '%binary%'
3081+
AND s.compile_time_value NOT LIKE 'N''%'''
3082+
AND s.compile_time_value NOT LIKE '''%''' THEN
3083+
QUOTENAME(compile_time_value, '''')
3084+
ELSE s.compile_time_value
30843085
END
30853086
FROM #stored_proc_info AS s
30863087
OPTION(RECOMPILE);

0 commit comments

Comments
 (0)