Convert lowercase amount to English

xiaoxiao2021-03-06  110

Create Function [DBO]. [F_num_eng] (@num numeric (15, 2)) Returns varchar (400) with encryptionasbegin - All Rights reserved. Pbsql declare @i int, @ hundreds int, @ TENTH INT, @ one int declare @THOUSAND INT, @Million int, @ Billion int declare @numbers var, @ s varchar (15), @ RESULT VARCHAR (400) Set @ number varchar (400) set @ NumBers = 'One Twie Four Five' 'Six Seven Eight Nine Ten ' ' eleven twelve thirteen fourteen fifteen ' ' sixteen seventeen eighteen nineteen ' ' twenty thirty forty fifty ' ' sixty seventy eighty ninety 'SET @ s = RIGHT (' 000000000000000 ' CAST (@num AS varchar (15)) , 15) SET @ BILLION = CAST (Substring (@ s, 1, 3) AS INT) - Different 12-digit integers into 4 paragraphs: billion, million, thousand, 100 ten set @ million = casters (Substring) @ s, 4, 3) as int) set @ thousand = CAST (Substring (@ s, 7, 3) as int) set @ result = 'set @ i = 0 while @i <= 3 begin set @ hundreds = Cast (@ s, @ i * 3 1, 1) AS INT) - Hundreds of 0-9 Set @ TENTH = CAST (Substring (@ s, @ i * 3 2, 1) as int) set @ One = (Case @TENTH WHEN 1 THEN 10 ELSE 0 END) CAST (Substring (@ s, @ i * 3 3, 1) AS INT) - Delin 0-19 Set @ TENTH = (Case When @Tenth <= 1 Then 0 else @tenth End) - Ten 0, 2-9 IF (@ i = 1 and @ @ = 1 Billion> 0 AND (@million> 0 or @thousand> 0 or @hundreds> 0)) OR (@ i = 2 AND (@billion> 0 or @million> 0) and (@thousand> 0 or @hundreds>

0))) OR (@ i = 3 AND (@billion> 0 or @million> 0 or @thousand> 0) And (@hundreds> 0)) set @ result = @ result ',' - 100 is not 0 Connecting between each paragraph, IF (@ i = 3 AND (@billion> 0 or @million> 0 or @thousand> 0) and (@ hundreds = 0 and (@tentH> 0 or @One> 0)))))) ) Set @ result = @ result 'and' - hundred places 0 plus connection and if @hundreds> 0 set @ result = @ result rtrim (Substring (@ number, @ hundreds * 10-9, 10)) 'hundred' if @TENTH> = 2 and @TENTH <= 9 begin if @Hundreds> 0 set @ result = @ result 'and' set @ result = @ result rtrim (Substring (@ Numbers, @ TENTH * 10 171, 10)) end if @ONE> = 1 and @ONE <= 19 begin if @tent> 0 set @ Result = @ rd '-' Else if @hundreds> 0 set @ result = @ result 'and' set @ Result = @ result rtrim (@ number (@ number)) end if @ i = 0 and @billion> 0 set @ result = @ r @ @ r @ @ r @ = 1 and @million > 0 set @ result = @ r = 2 and @thousand> 0 set @ result = @ = @ i 1 end if substring (@ s, 1 4, 2) <> '00' begin set @ result = @ result 'point' if substring (@ s, 14, 1) = '0' set @ result = @ result 'zero' else set @ result = @ ru

转载请注明原文地址:https://www.9cbs.com/read-99018.html

New Post(0)