Skip to content

Commit 1901057

Browse files
committed
#2847 Fix negative CHARINDEX result when ) precedes (
Setting the `starting_position` of the `(` found when retrieving the closing `)` will keep us out of the negative sub-string length.
1 parent c475b84 commit 1901057

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sp_BlitzCache.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3982,7 +3982,7 @@ SET s.variable_datatype = CASE WHEN s.variable_datatype LIKE '%(%)%'
39823982
s.compile_time_value = CASE WHEN s.compile_time_value LIKE '%(%)%'
39833983
THEN SUBSTRING(s.compile_time_value,
39843984
CHARINDEX('(', s.compile_time_value) + 1,
3985-
CHARINDEX(')', s.compile_time_value) - 1 - CHARINDEX('(', s.compile_time_value)
3985+
CHARINDEX(')', s.compile_time_value, CHARINDEX('(', s.compile_time_value) + 1) - 1 - CHARINDEX('(', s.compile_time_value)
39863986
)
39873987
WHEN variable_datatype NOT IN ('bit', 'tinyint', 'smallint', 'int', 'bigint')
39883988
AND s.variable_datatype NOT LIKE '%binary%'

0 commit comments

Comments
 (0)