In SQL, the function converts the amount to Chinese, and the SQL function converts the amount to Chinese.
Create function [dbo]. [f_num_chn] (@ num numeric (14,2))
RETURNSVarchar(100) WITH ENCRYPTION
AS
BEGIN
-- Copyright: pbsql
DECLARE @ n_dataVARCHAR(20), @ C_dataVARCHAR(100), @ N_strVARCHAR(10), @ IInt
SET @ n_data = RIGHT (SPACE (14) + CAST (ABS (@ num *100)Bigint)Varchar(20)),14)
SET @ c_data =''
SET @ I =1
WHILE @ I <=14
BEGIN
SET @ n_str = SUBSTRING (@ n_data, @ I,1)
IF @ n_str <>''
BEGIN
IF not (SUBSTRING (@ n_data, @ I,2) = '00') or
(@ N_str = '0') and (@ I =4) Or (@ I =8) Or (@ I =12) Or (@ I =14))))
SET @ c_data = @ c_data + SUBSTRINGInt) +1,1)
IF not (@ n_str = '0') and (@ I <>4) And (@ I <>8) And (@ I <>12))
SET @ c_data = @ c_data + SUBSTRING,1)
If substring (@ c_data, LEN (@ c_data )-1,2) = '100%'
SET @ c_data = SUBSTRING (@ c_data,1, LEN (@ c_data )-1)
END
SET @ I = @ I +1
END
IF @ num <0
SET @ c_data = '(negative number)' + @ c_data
IF @ num =0
SET @ c_data = 'circle 0'
IF @ n_str = '0'
SET @ c_data = @ c_data + 'Integral'
RETURN (@ c_data)
END