2

在我们的 SQL Server 2005 机器上,我遇到了一个错误,即在为具有某些字符限制的下游系统准备数据时,所有的 'f' 字符都被丢弃了。

我发现 UDF 中有一条语句试图用 '' 替换 'φ' 字符。问题是,至少在我们安装的 SQL Server 中,“φ”和“f”是同一个东西。

有人能告诉我区分“φ”和“f”的最佳方法是什么吗?

例子:

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

对我来说,这返回“相等”

4

1 回答 1

6

在字符串文字中使用N'φ',这样它就不会被强制转换为默认排序规则。

对我来说(下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*/
于 2011-01-07T16:32:29.880 回答