Create Procedure AtoC
@ ChangeMoney Money
As
Set Nocount ON
Declare @ String1 char (20)
Declare @ String2 char (30)
Declare @ String4 Varchar (100)
Declare @ String3 Varchar (100) -- value retrieved from the original A value
Declare @ I int -- cyclic variable
Declare @ J Int -- the value of A multiplied by the string length of 100
Declare @ brief Varchar (100) -- Chinese reading of numbers
Declare @ Ch2 Varchar (100) -- Chinese character reading of digits
Declare @ Zero Int -- used to calculate the number of consecutive Zeros
Declare @ ReturnValue VarChar (100)
Select @ ReturnValue =''
Select @ String1 = 'Zero, zero, three, three, two, three, three'
Select @ String2 = 'tens of thousands of yuan worth a thousand yuan a cent'
Select @ String4 = Cast (@ changemone* 100 as int)
Select @ J = len (cast (@ ChangeMoney * 100) as int ))
Select @ String2 = Right (@ String2, @ J)
Select @ I = 1
While @ I <= @ j Begin
Select @ String3 = Substring (@ String4, @ I, 1)
If @ String3 <> '0' Begin
Select @ Substring = Substring (@ String1, Cast (@ String3 as Int) 1, 1)
Select @ Ch2 = Substring (@ String2, @ I, 1)
Select @ Zero = 0 -- indicates that the base is not Zero
End
Else Begin
If (@ Zero = 0) Or (@ I = @ J-9) Or (@ I = @ J-5) Or (@ I = @ J-1)
Select @ resolve = '0'
Else
Select @ region =''
Select @ Zero = @ Zero 1 -- indicates that the base is 0
-- If the value to be converted needs to be expanded, you need to change the value of the following expression I.
Select Ch2 =''
If @ I = @ J-10 Begin
Select @ Ch2 = '100'
Select @ Zero = 0
End
If @ I = @ J-6 Begin