在SQL Server中规范化Unicode字符串? [英] Normalize unicode string in SQL Server?

查看:133
本文介绍了在SQL Server中规范化Unicode字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQL Server中是否有一个函数可以规范化unicode字符串?例如

Is there a function in SQL Server to normalize a unicode string? e.g.

UPDATE Orders SET Notes = NormalizeString(Notes, 'FormC')

Unicode规范化形式:

Unicode Normalization Forms:

  • C 和位置( C ):A + ¨变为Ä
  • D ​组成( D ):Ä变为A + ¨
  • 兼容的成分( KC ):A + ¨ + + n变为Ä + f + i + n
  • 兼容分解( KD ):Ä + + n变为A + ¨ + f + i + n
  • C​omposition (C): A + ¨ becomes Ä
  • D​ecomposition (D): Ä becomes A + ¨
  • Compatible Composition (KC): A + ¨ + + n becomes Ä + f + i + n
  • Compatible Decomposition (KD): Ä + + n becomes A + ¨ + f + i + n

我找不到任何内置函数,所以我假设没有.

i cannot find any built-in function, so i assume there is none.

理想情况下,如果只能有一个,那么我今天恰好需要表格C:

Ideally, if there can be only one, then i happen to need Form C today:

Unicode规范化形式C,规范组成.将由基本字符加组合字符组成的每个分解后的分组转换为规范的预先组合后的等价物.例如,A +¨变为Ä.

Unicode normalization form C, canonical composition. Transforms each decomposed grouping, consisting of a base character plus combining characters, to the canonical precomposed equivalent. For example, A + ¨ becomes Ä.

另请参见

  • Windows中的Unicode规范化
  • 如何删除变音符号(重音符号)从.NET中的字符串中获取?
  • NormalizeString函数
  • 全部整理出来:SQL Server使用哪种规范化形式
  • See also

    • Unicode Normalization in Windows
    • How do I remove diacritics (accents) from a string in .NET?
    • NormalizeString function
    • Sorting it all out: What normalization form does SQL Server use
    • 推荐答案

      对不起,不,到目前为止,任何版本的SQL Server(2012测试版)中都没有这样的功能.比较可以正确地对组成不敏感,但是没有将字符组成用法转换为一种正常形式的功能.

      Sorry, no, there is no such function in any version of SQL Server to date (2012 test builds). Comparisons can be correctly composition-insensitive, but there isn't a function to convert character composition usage to one normal form.

      有人建议在语法NORMALIZE(string, NFC)下使用ANSI标准的将来版本,但是要使它成为现实还需要很长时间.现在,如果要进行规范化,则必须使用具有更好的字符串处理功能的适当编程语言来进行规范化,方法是将字符串从数据库中拉出或编写CLR存储过程来进行.

      It has been suggested for a future version of the ANSI standard under the syntax NORMALIZE(string, NFC) but it's going to be a long time before this makes it to the real world. For now if you want to do normalisation you'll have to do it in a proper programming language with better string-handling capabilities, either by pulling the string out of the database or by writing a CLR stored procedure to do it.

      这篇关于在SQL Server中规范化Unicode字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆