I'm on SQL Server 2016 with default settings, and can't understand whey this line 4 doesn't catch my weird character ?
which A with the roof. It's matched by [a-z] range, never thought that it would be the case. Is the any solution to work it out with the range ? In my example below I expect to display single record, but line 4 doesn't allow me do so. Is line 5 with the list the only solution???
Interesting that CHAR(13) is of of the range and works fine.
DECLARE @a VARCHAR(10) = CHAR(13) +'Delta', @b NVARCHAR(20) = '?' + 'Hotel';
SELECT @a A, LEN(@a) LenA, @b B, LEN(@b) LenB
,CASE WHEN @b < 'A' THEN 'LessA' ELSE CASE WHEN @b > 'Z' THEN 'GreaterZ' ELSE '? Between' END END sw
WHERE 1=1
AND @b NOT LIKE '[A-Z]%' --- Line 4: <<< '?' in the range [a-z] or [A-Z] , how I can only work with 26 English letter range ???
-- AND @b NOT LIKE '[ABCDEFHGW]%' --- Line 5: <<< is writing the list the only solution ?
-- AND @b LIKE '?%'
-- COLLATE Latin1_General_CS_AS
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…