Home Dashboard Directory Help
Search

Problem select ... where col like 'CCI%' with SQL_Slovak_Cp1250_CI_AS collation by skyfun


Status: 

Closed
 as Won't Fix Help for as Won't Fix


1
0
Sign in
to vote
Type: Bug
ID: 779746
Opened: 2/21/2013 1:40:57 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

Following select causes wrong result, if is used collation SQL_Slovak_Cp1250_CI_AS or SQL_Czech_Cp1250_CI_AS.

select * from tab where col1 like 'CCI%'

If is used collation Slovak_CI_AS, SQL_Polish_Cp1250_CI_AS or other result is correct.
If is used nvarchar instead of varchar for column type result is correct.
If is used similar expression ( 'ZCI%' ) the result is wrong again.

This may be due to the different order of the letters in the Slovak or Czech alphabet. Leter order is A, B, C, D, E, F, G, H, CH, I, J ...

I tried the following versions SQL Server 2005, 2008, 2012.
Details
Sign in to post a comment.
Posted by Microsoft on 3/8/2013 at 11:51 AM
Hello,
Thanks for reporting the issue. This is a bug that exists in all current versions of SQL Server for SQL collations, char/varchar columns and LIKE operator. The SQL collations that are affected are specifically those with double-byte characters like CH, ZH that are considered single characters and sort along with the Latin characters.
Given the nature of the problem (existence in all versions) and our current priorities we will not be fixing this bug. The workaround to avoid the optimization that can result in the incorrect results is do below:

where col1 + '' like 'CCI%'

--
Umachandar, SQL Programmability Team
Sign in to post a workaround.