• Robert-378556 (12/3/2012)


    SQL Kiwi (12/3/2012)


    Jaroslav Pfauser (12/3/2012)


    (0 row(s) affected)

    SQL2008 (64-bit) SP2

    It seems you wrote a test script that did not cover the full range of possibilities. Include CHAR(198) and CHAR(230) in your test.

    (2 row(s) affected)

    Doesn't the test sql provided in answer already do that?

    On my server it returns 0 rows, so it appears like some other things affect this. Maybe default collation. Probably.

    Oh my apologies - I didn't even read the explanation today.

    Of course the question should have used a SQL collation, not a Windows one that takes account of Windows language settings. Using a SQL collation would ensure that everyone used the same code page and displayed the same characters (well, almost):

    SELECT CHAR(198) COLLATE SQL_Czech_CP1250_CI_AS, CHAR(230) COLLATE SQL_Czech_CP1250_CI_AS;

    SELECT CHAR(198) COLLATE SQL_Latin1_General_CP1_CI_AI, CHAR(230) COLLATE SQL_Latin1_General_CP1_CI_AI;

    +-------+

    ¦ A ¦ a ¦

    ¦---+---¦

    ¦ Æ ¦ æ ¦

    +-------+