Normalize unicode string in SQL Server?(规范化 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+¨变为Ä代码> - Decomposition (D):
Ä变成A+¨代码> - 兼容组合(KC):
A+¨+fi+n变成Ä+f+i+n - 兼容分解(KD):
Ä+fi+n变成A+¨+f+i+n
- Composition (C):
A+¨becomesÄ - Decomposition (D):
ÄbecomesA+¨ - Compatible Composition (KC):
A+¨+fi+nbecomesÄ+f+i+n - Compatible Decomposition (KD):
Ä+fi+nbecomesA+¨+f+i+n
我找不到任何内置函数,所以我假设没有.
i cannot find any built-in function, so i assume there is none.
理想情况下,如果只能有一个,那么我今天恰好需要Form 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 使用什么规范化形式
推荐答案
抱歉,不,迄今为止的任何版本的 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 字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:规范化 SQL Server 中的 unicode 字符串?
基础教程推荐
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- 在多列上分布任意行 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
