How to collate SQL_Latin1_General_CP1_CI_AS using IN operator

前端 未结 1 733
庸人自扰
庸人自扰 2021-02-19 18:22

I want to filter records on \'Email\' my query is like this.

SELECT * FROM #temp WHERE email NOT IN (SELECT email FROM Customer)

It gives me fo

1条回答
  •  心在旅途
    2021-02-19 19:02

    ...
    NOT IN (SELECT email COLLATE SQL_Latin1_General_CP1_CI_AS AS email FROM Customer)
    

    The collate bit follows the column name, basically.

    Or this (it depends on which one you want):

    SELECT * FROM #temp WHERE email collate SQL_Latin1_General_CP1_CI_AS NOT IN (SELECT email FROM Customer) 
    

    Finally, if your DB is SQL_Latin1_General_CP1_CI_AS, one option is to use ...COLLATE Database_Default... to coerce to a default setting.

    0 讨论(0)
提交回复
热议问题