开发者

Problem with transliteration of 'φ' to 'f' in SQL Server 2005

开发者 https://www.devze.com 2023-02-02 20:52 出处:网络
On our SQL Server 2005 machine, I encountered a bug where all the \'f\' characters were getting dropped when preparing data for a downstream system that has some character limitations.

On our SQL Server 2005 machine, I encountered a bug where all the 'f' characters were getting dropped when preparing data for a downstream system that has some character limitations.

What I found was that there was a statement in a UDF that was attempting to replace 'φ' characters with ''. The problem is that, at least in our installation of SQL Server, 'φ' and 'f' are the same thing.

Can someone tell me what would be the best way to differentiate between 'φ' and 'f'?

开发者_开发技巧

example:

select case when 'φ' = 'f' then 'equal' else 'not equal' end

For me, this returns 'equal'


Use N'φ' in the string literal so it doesn't get coerced into the default collation.

For me (under SQL_Latin1_General_CP1_CS_AS)

select case when 'φ' = 'f' then 'equal' else 'not equal' end /*equal*/

select case when N'φ' = 'f' then 'equal' else 'not equal' end /*not equal*/
0

精彩评论

暂无评论...
验证码 换一张
取 消