Small write maximum amount

zhaozj2021-02-17  49

Seeing an ORACLE version of the version of the server to see a function of a lower-write amount, it feels good to turn it into a SQL Server version.

/ ************************************************** ******* author: (birdie_7761@cmmail.com) version: 1.0 created: 20,020,227 modified: function: lowercase to uppercase amount of parameters: n_LowerMoney amount in v_TransType species - 1: directly translate, 0: read IT in Words Output: Capital Amount ************************************************************* ************* / CREATE FUNCTION DBO.L2U (@n_lowermoney Numeric (15, 2), @ v_transtype int) Returns varchar (200) as begin declare @v_lowerstr varchar (200) - lowercase Declare @v_upperpart varchar (200) Declare @v_upperstr varchar (200) - Uppermaster Declare @i_i int

Set @v_lowerstr = LTRIM (RTRIM (@ n_lowermoney, 2))) - Self-rouse into the specified accuracy and delete data left and right space set @i_i = 1set @v_upperstr = ''

While (@i_i <= len (@v_lowerstr)) Begin Select @v_upperpart = Case Substring (@v_lowerstr) - @i_i 1, 1) when '.' Ten 'Yuan' When '0' Then ' Zero 'When' 1 'Then' 壹 'When' 2 'Ten' 'When' 3 'Ten' 'When' 4 'Ten' 'When' 5 'Ten' Wu 'When' 6 'Ten' Lu ' WHEN '7' TEN '柒' WHEN '8' TEN '捌' When '9' Ten '' end case @i_i when 1 Then 'points' When 2 Ten' angle 'When 3 Then' 'WHEN 4 THEN' 'When 5 TEN' Picking 'WHEN 6 THEN 'WHEN 7 TEN' WHEN 8 TEN 'WHEN' WHEN 9 THEN 'Picking' WHEN 10 TEN 'WHEN' WHEN 11 TEN '仟' WHEN 12 TEN 'Y' WHEN 13 TEN 'Picking' WHEN 14 THEN ' '

WHEN 15 THEN 'thousand' WHEN 16 THEN 'Wan' ELSE '' ENDset @v_UpperStr = @v_UpperPart @v_UpperStrset @i_I = @i_I 1endif (0 = @v_TransType) beginset @v_UpperStr = REPLACE (@v_UpperStr, 'zero pick' , 'Zero') set @v_upperstr = Replace (@v_upperstr, 'zero', 'zero') set @v_upperstr = Replace (@v_upperstr, 'zero', 'zero') set @v_upperstr = Replace (@v_upperstr, 'Zero zero', 'zero') set @v_upperstr = Replace (@v_upperstr, 'zero ",' zero ') set @v_upperstr = Replace (@v_upperstr,' zero zero point ',' whole ') set @ v_upperstr = replace (@v_upperstr, 'zero ",' whole ') set @v_upperstr = Replace (@v_upperstr,' zero", 'zero') set @v_upperstr = Replace (@v_upperstr, 'qiyi 零 元',' Billion ') set @v_upperstr = Replace (@v_upperstr,' billion yuan ", 'billion') set @v_upperstr = Replace (@v_upperstr, 'qi million",' billion ') set @v_upperstr = replace (@v_upperstr, '零 元', '10,000 yuan') set @v_upperstr = Replace (@v_upperstr, '零 零', '10,000 yuan') set @v_upperstr = Replace (@v_upperstr, ' 1.0 million ',' billion ') set @v_upperstr = Replace (@v_upperstr,' 万 ',' 10) set @v_upperstr = Replace (@v_upperstr, 'zero ",' metad ') S ET @v_upperstr = Replace (@v_upperstr, 'zero ",' zero ') end

- Processing of the amount below ('yuan' = substring (@ v_upperstr, 1, 1)) begin set @v_upperstr = Substring (@ v_upperstr, 2, (@v_upperstr) - 1)) Endif 'Zero' = Substring (@ v_upperstr, 1, 1)) begin set @v_upperstr = Substring (@ v_upperstr, 2, (@v_upperstr) - 1)) END

IF ('angle' = substring (@ v_upperstr, 1, 1)) begin set @v_upperstr = Substring (@ v_upperstr, 2, (@v_upperstr) - 1)) END

IF ('points' = substring (@ v_upperstr, 1, 1)) begin set @v_upperstr = Substring (@ v_upperstr, 2, (@v_upperstr) - 1)) End

IF ('whole' = substring (@ v_upperstr, 1, 1)) begin set @v_upperstr = 'zero element' endreturn @v_upperstrend

example:

Select DBO.L2U (56588441.111, 0)

Select DBO.L2U (00.00, 0)

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

New Post(0)