Capital | function | amount | lowercase | chinese | convert
CREATE FUNCTION [dbo]. [F_num_chn] (@num numeric (14,2))
RETURNS varchar with encryption
As
BEGIN
--All rights reserved: Pbsql
DECLARE @n_data VARCHAR (VARCHAR), @c_data (a), @n_str VARCHAR (a), @i int
SET @n_data =right (+cast (ABS (@num *100) as bigint) as varchar (20)), 14
SET @c_data = '
SET @i=1
While @i<=14
BEGIN
SET @n_str =substring (@n_data, @i,1)
IF @n_str <> '
BEGIN
IF Not ((SUBSTRING (@n_data, @i,2) = ') or
((@n_str = ' 0 ') and ((@i=4) or (@i=8) or (@i=12) or (@i=14)))
SET @c_data = @c_data +substring (' 0 Woolu ba Nine ', CAST (@n_str as int) +1,1)
IF not ((@n_str = ' 0 ') and (@i<>4) and (@i<>8) and (@i<>12))
SET @c_data = @c_data +substring (' Thousand Hundred million thousand thousand hundred to collect the rounded corner cent ', @i,1)
IF SUBSTRING (@c_data, LEN (@c_data) -1,2) = ' billions '
SET @c_data =substring (@c_data, 1,len (@c_data)-1)
End
SET @i=@i+1
End
IF @num <0
SET @c_data = ' (negative number) ' + @c_data
IF @num =0
SET @c_data = ' 0 Circle '
IF @n_str = ' 0 '
SET @c_data = @c_data + ' whole '
Return (@c_data)
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.