Sample Header Ad - 728x90

Why does a comparison between 'tr' & 'tR' fail on a SQL Server with Vietnamese_CI_AI collation?

14 votes
1 answer
1211 views
There seems to be something special about 'tR' in Vietnamese collation. Appreicate if anyone who knows about it can explain in simple terms. This issue was discovered during the installation of our product on a "Vietnamese" collated SQL Server. One of the tables in the schema has 'tR' in it's name but a stored procedure is referencing the table in all lower case 'tr'. And this reference fails. I guess this situation is analogous to '阝' matching 'ss' in other collations. Here is a reproduction:
select  case when 'tr' = 'tR' COLLATE SQL_Latin1_General_CP1_CI_AS   then 'match' else 'no match' end 
select  case when 'tr' = 'tR' COLLATE Vietnamese_CI_AI   then 'match' else 'no match' end 
select  case when 'tr' = 'TR' COLLATE Vietnamese_CI_AI   then 'match' else 'no match' end
Results:
-----
match


--------
no match


-----
match
The second T-SQL produces the mismatch. Other combinations of 't' and 'R' do not.
Asked by QFirstLast (451 rep)
Aug 24, 2021, 06:59 PM
Last activity: Aug 26, 2021, 09:18 PM