The reprint link is unknown.
The following is the reproduced content:
--This method is used to convert the currency form of Arabic numerals to uppercase currency form --Test: select dbo.toUppercaseRMB(12131415.21); result: one thousand two hundred one hundred thirty thousand one thousand four hundred one hundred five yuan two corners one cent CREATE function [dbo].[toUppercaseRMB] ( @LowerMoney decimal(18,4)) returns varchar(200) as begin declare @lowerStr varchar(200) declare @UpperStr varchar(200) declare @UpperPart varchar(200) --length declare @i int set @lowerStr=ltrim(rtrim(convert(decimal(18,2),round(@LowerMoney,2)))) set @i=1 set @UpperStr='' while(@i<=len(@lowerStr)) begin select @UpperPart= case substring(@lowerStr,len(@lowerStr)-@i+1,1)--take the last digit when '.' then '元' when '0' then '零' when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' end + case @i when 1 then '分' when 2 then '角' when 3 then '' when 4 then '' when 5 then '拾' when 6 then '佰' when 7 then '仟' when 8 then '万' when 9 then '拾' when 10 then '佰' when 11 then '仟' when 12 then '亿' when 13 then '拾' when 14 then '佰' when 15 then '仟' when 16 then '万' else '' end set @UpperStr=@UpperPart+@UpperStr set @i=@i+1 end set @UpperStr = REPLACE(@UpperStr,'零拾','零') set @UpperStr = REPLACE(@UpperStr,'零佰','零') set @UpperStr = REPLACE(@UpperStr,'zero thousand zero hundred zero pick','zero') set @UpperStr = REPLACE(@UpperStr,'零仟','零') set @UpperStr = REPLACE(@UpperStr,'zero zero zero','zero') set @UpperStr = REPLACE(@UpperStr,'zero zero','zero') set @UpperStr = REPLACE(@UpperStr,'zero corner zero minute','') set @UpperStr = REPLACE(@UpperStr,'零分','') set @UpperStr = REPLACE(@UpperStr,'zero angle','zero') set @UpperStr = REPLACE(@UpperStr,'00,000,000,000,000,000,000,000') set @UpperStr = REPLACE(@UpperStr,'100 million yuan','100 million yuan') set @UpperStr = REPLACE(@UpperStr,'billion','billion') set @UpperStr = REPLACE(@UpperStr,'00,000,000 yuan','10,000 yuan') set @UpperStr = REPLACE(@UpperStr,'10,000 yuan','10,000 yuan') set @UpperStr = REPLACE(@UpperStr,'零亿','亿') set @UpperStr = REPLACE(@UpperStr,'零万','万') set @UpperStr = REPLACE(@UpperStr,'zero element','element') set @UpperStr = REPLACE(@UpperStr,'zero zero','zero') if left(@UpperStr,1)='元' set @UpperStr = REPLACE(@UpperStr, 'element', 'zero element') return @UpperStr+'整' end