Amount of Arabic numerals converted to Chinese stored procedures
Source: Internet
Author: User
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 removed from the original a value
Declare @i INT--loop variable
Declare the value of the @j Int--a times the string length of 100
Declare @Ch1 Varchar (100)--Digital Chinese reading method
Declare @Ch2 Varchar (100)--Chinese character reading method of digit digit
Declare @Zero Int--Used to compute a continuous number of zeros
Declare @ReturnValue VarChar (100)
Select @ReturnValue = '
Select @String1 = ' 0 Woolu qi Ba Nine '
Select @String2 = ' thousand thousand hundred million thousand thousand hundred pick up the corner points '
Select @String4 = Cast (@ChangeMoney *100 as int)
Select @j=len ((@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 @Ch1 = Substring (@String1, Cast (@String3 as Int) 1, 1)
Select @Ch2 = Substring (@String2, @i, 1)
Select @Zero = 0--Represents the standard is not zero
End
else Begin
If (@Zero = 0) or (@i = @j-9) or (@i = @j-5) or (@i = @j-1)
Select @Ch1 = ' 0 '
Else
Select @Ch1 = '
Select @Zero = @Zero 1--The representation standard is 0
-If the converted value needs to be enlarged, change the value of the expression I below.
Select Ch2 = '
If @i = @j-10 Begin
Select @Ch2 = ' billion '
Select @Zero = 0
End
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.