The SQL DISTINCT clause isn't Case Sensitive.

The SQL DISTINCT clause isn't Case Sensitive. So the query might end up pulling records with different cases.

A simple fix is to use the COLLATE clause in conjunction with the DISTINCT Clause.

 

e.g.

a) CASE INSENSITIVE DISTINCT CLAUSE

SELECT DISTINCT (Item) COLLATE sql_latin1_general_cp1_cs_as

    FROM (

           SELECT  'a' item

          UNION ALL SELECT  'A'

        )items

 

b) CASE SENSITIVE DISTINCT CLAUSE

SELECT DISTINCT (Item) COLLATE sql_latin1_general_cp1_ci_ai

    FROM (

           SELECT  'a' item

          UNION ALL SELECT  'A'

        ) items

By [)ia6l0 iii   Popularity  (1214 Views)