1

Topic: LIKE

Hello world!
In ASCII ' A ' character has the code 65, ' z ' character - the code 122. In a range in between there is ' \' character with the code 92

declare @t1 as varchar (100)
set @t1 = ' \'
SELECT CAST (@t1 AS binary) AS Hex;
CASE WHEN @t1 like ' % [A-z] %'
THEN N', in the RANGE'
ELSE N', not in the RANGE'
END AS [ASCII A-z]

Prompt, why like it does not find?

2

Re: LIKE

Yagrus2;
All depends from COLLATE. It at you what?
If it is necessary to arrange on the codes of characters;
That can be applied binary, for example, Cyrillic_General_BIN

3

Re: LIKE

declare @t1 as varchar (100)
set @t1 = ' \'
SELECT CAST (@t1 AS binary) AS Hex;
CASE WHEN @t1 like ' % [A-z] % ' COLLATE Cyrillic_General_BIN
THEN N', in the RANGE'
ELSE N', not in the RANGE'
END AS [ASCII A-z]

4

Re: LIKE

iap;
Thanks, for the answer!
At me  SQL_Latin1_General_CP1_CI_AS

5

Re: LIKE

Yagrus2 wrote:

iap;
Thanks, for the answer!
At me  SQL_Latin1_General_CP1_CI_AS

the Order of characters in it COLLATE is easy for seeing:

SELECT v.number, =CHAR (v.number [character]
FROM master.dbo.spt_values v
WHERE v.type ='P ' AND v.number BETWEEN 32 AND 254
ORDER BY CHAR (v.number) COLLATE SQL_Latin1_General_CP1_CI_AS;

But it is necessary to mean that COLLATE influences ordering not only separate characters;
And and some combinations of characters (for example, "ch", "ph", etc.).
In general, to apply character ranges (for example, A-z), is necessary with care.

6

Re: LIKE

iap;
Thanks detailed clarification!
Only here I will not understand...
CI - sets register ignoring.
In your request:
Latin characters with the same name are grouped the upper-bottom register, lower-top;
And cyrillic is bunched by groups all capital and all small...
Prompt, to what it is connected?

7

Re: LIKE

Yagrus2 wrote:

CI - sets register ignoring.
In your request:
Latin characters with the same name are grouped the upper-bottom register, lower-top;
And cyrillic is bunched by groups all capital and all small...
Prompt, to what it is connected?

To that also it is connected that cyrillic should Cyrillic  be sorted;
Instead of Latin: in Latin cyrillics simply are not present.
So it simply is not sorted, as it , and threw out