Create Function fun_getbh (@str nvarchar (4000))
Returns Int
AS
Begin
Declare @Word nchar (1), @ n int
Set @ n = 0
While Len (@STR)> 0
Begin
Set @ Word = Left (@ Str, 1)
- If not Chinese characters, strokes
Set @ n = @ n (Case When Unicode (@Word) Between 19968 and 19968 20901
(SELECT TOP 1 ID FROM)
SELECT 1 AS ID, N '亅' AS Word
Union all SELECT 2, N '阝'
Union all SELECT 3, N 'Horse'
Union All SELECT 4, N 'Wind'
Union all SELECT 5, N 'Dragon'
Union all SELECT 6, N 'Qi'
Union All SELECT 7, N 'Turtle'
Union all SELECT 8, N 'Tooth'
Union all SELECT 9, N '鸩'
Union all SELECT 10, N '龀'
Union All Select 11, N ''
Union all SELECT 12, N '龂'
Union all SELECT 13, N '龆'
Union all SELECT 14, N 'galid'
Union all SELECT 15, N '龊'
Union all SELECT 16, N 'Dragon'
Union all SELECT 17, N '龠'
Union all SELECT 18, N '厐'
Union all SELECT 19, N 'Pang'
Union all SELECT 20, N '龑'
Union all SELECT 21, N '龡'
Union all SELECT 22, N 'and'
Union all SELECT 23, N '龝'
Union all SELECT 24, N '齹'
Union all SELECT 25, N '龣'
Union all SELECT 26, N '龥'
Union all SELECT 27, N '齈'
Union all SELECT 28, N '龞'
Union all SELECT 29, N '麷'
Union all SELECT 30, N '鸾'
Union All SELECT 31, N '麣'
Union all SELECT 32, N '龖'
Union all SELECT 33, N '龗'
Union all SELECT 35, N '齾'
Union all SELECT 36, N '齉'
Union all SELECT 39, N '靐'
Union all SELECT 64, N '龘'
T
WHERE WORD> = @ Word Collate Chinese_Prc_Stroke_CS_AS_KS_WS
ORDER BY ID ASC) ELSE 0 END)
Set @ Str = Right (@ Str, Len (@str) -1)
end
Return @n
end
- Function call instance:
Select dbo.fun_getbh ('"People's Republic'), DBO.FUN_GETBH ('The People's Republic of China)