我需要按姓名搜索人员。这里的人名可以是英文、韩文或中文。为此我使用了Like
搜索条件Name
如下:
select * from [MyTable] where Name like N'%t%'
上述声明是给所有包含字母的用户t
。但这不适用于韩语或中文。就像我用韩文字母搜索一样ㅈ
那么它应该给出包含这个字母的所有名称,例如**정수연, 재훈아이팟, 정원혁 테스트 7**
。我尝试过以下方法,但结果为零
select * from [MyTable] where Name like N'%ㅈ%' - No Results
select PATINDEX(N'%ㅈ%',N'정수연(Mohan)') - giving value as ZERO
select Charindex(N'ㅈ',N'정수연') - giving value as ZERO
有没有办法在SQL Server中找到其他语言的字母表?
我知道如何通过使用编码技术在 C# 单词中查找其他语言中的字母表存在,但不知道如何在 SQL Server 中查找字母表。请在这方面帮助我。
提前致谢。
编辑 C# 代码
public static string DecomposeSyllabels(string unicodeString) {
try {
//Consonant consonant only used
string[] JLT = { "ㄱ", "ㄲ", "ㄴ", "ㄷ", "ㄸ", "ㄹ", "ㅁ", "ㅂ", "ㅃ", "ㅅ", "ㅆ", "ㅇ", "ㅈ", "ㅉ", "ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ" };
// Only used a collection of neutral
string[] JVT = { "ㅏ", "ㅐ", "ㅑ", "ㅒ", "ㅓ", "ㅔ", "ㅕ", "ㅖ", "ㅗ", "ㅘ", "ㅙ", "ㅚ", "ㅛ", "ㅜ", "ㅝ", "ㅞ", "ㅟ", "ㅠ", "ㅡ", "ㅢ", "ㅣ" };
// Initial and coda consonants used in
string[] JTT = { "", "ㄱ", "ㄲ", "ㄳ", "ㄴ", "ㄵ", "ㄶ", "ㄷ", "ㄹ", "ㄺ", "ㄻ", "ㄼ", "ㄽ", "ㄾ", "ㄿ", "ㅀ", "ㅁ", "ㅂ", "ㅄ", "ㅅ", "ㅆ", "ㅇ", "ㅈ", "ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ" };
double SBase = 0xAC00;
long SCount = 11172;
int TCount = 28;
int NCount = 588;
string syllables = string.Empty;
foreach (char c in unicodeString) {
double SIndex = (int)c - SBase;
if (0 > SIndex || SIndex >= SCount) {
syllables = syllables + c;
continue;
}
int LIndex = (int)Math.Floor(SIndex / NCount);
int VIndex = (int)(Math.Floor((SIndex % NCount) / TCount));
int TIndex = (int)(SIndex % TCount);
syllables = syllables + (JLT[LIndex] + JVT[VIndex] + JTT[TIndex]);
}
return syllables;
}
catch {
return unicodeString;
}
}