Home > database >  Benefits for bosses to essentially of a number of English capital function
Benefits for bosses to essentially of a number of English capital function

Time:10-10

Benefits for bosses to essentially of a number of English capital function

CodePudding user response:

 CREATE FUNCTION [dbo] [NumToChn] (@ num NUMERIC (19, 6)) 
RETURNS NVARCHAR (100)
AS
The BEGIN
DECLARE @ n_data NVARCHAR (20), @ c_data NVARCHAR (100), @ n_str NVARCHAR (10), @ I INT
The SET @ n_data=https://bbs.csdn.net/topics/RIGHT (SPACE (14) + CAST (CAST (ABS (@ num * 100) AS BIGINT) AS NVARCHAR (20)), 14)
The SET @ c_data=https://bbs.csdn.net/topics/'
WHILE the SET @ I=1 @ I & lt;=14
The BEGIN
The SET @ n_str=the SUBSTRING (@ n_data, @ I, 1)
IF @ n_str & lt;> '
BEGIN the IF NOT ((SUBSTRING (@ n_data, @ I, 2)='00') OR ((@ n_str='0') AND ((@ I=4) OR (@ I=8) OR (@ I=12) OR (@ I=14))))
SET @ c_data=https://bbs.csdn.net/topics/@c_data+SUBSTRING (N 'zero remark 3 boss wu lu and pure nine', CAST (@ n_str AS INT) + 1, 1)
IF NOT ((@ n_str='0') AND (@ I & lt;> 4) AND (@ I & lt;> 8) AND (@ I & lt;> 12))
SET @ c_data=https://bbs.csdn.net/topics/@c_data+SUBSTRING (N 'thousand hundred thousands pick up hundred thousand hundred thousand hundred up corner points', @ I, 1)
IF the SUBSTRING (@ c_data, LEN (@ c_data) - 1, 2)=N 'billions'
The SET @ c_data=https://bbs.csdn.net/topics/SUBSTRING (@ c_data, 1, LEN (@ c_data) - 1) END
The SET @ I=@ I + 1 END IF @ num & lt; 0
The SET @ c_data=https://bbs.csdn.net/topics/'(negative) + @ c_data
IF @ num=0 SET @ c_data=https://bbs.csdn.net/topics/'zero circle'
IF @ n_str='0'
The SET @ c_data=https://bbs.csdn.net/topics/@c_data+ 'whole'
RETURN (@ c_data)
END

CodePudding user response:

 CREATE FUNCTION [dbo] [Num2eng] (@ num numeric (15, 2)) 
RETURNS a varchar (400) WITH ENCRYPTION
AS
The BEGIN
- All rights reserved. PBSQL
DECLARE @ I int, @ hundreds int, @ tenth int, @ one int
DECLARE @ thousand int, @ m letters int, @ $int
DECLARE @ Numbers varchar (400), @ s varchar (15), @ result varchar (400)
The SET @ Numbers='one, two three four five'
+ 'six, seven eight says ten'
+ '7-eleven's twelve thirteen fourteen fifteen'
+ 'sixteen seventeen eighteen nineteen'
+ 'twenty-three thirty forty looking'
+ 'sixty seventy eighty ninety'
The SET @ s=RIGHT (' 000000000000000 '+ CAST (@ num AS varchar (15)), 15)
SET @ $=CAST (SUBSTRING (@ s, 1, 3) AS int) - will be 12 integer divided into four sections: billion, millions, qian, the few hundred
The SET @ m letters=CAST (SUBSTRING (@ s, 4, 3) AS int)
The SET @ thousand=CAST (SUBSTRING (@ s, 7, 3) AS int)
The SET @ result='
The SET @ I=0
WHILE @ i<=3
The BEGIN
The SET @ hundreds=CAST (SUBSTRING (@ s @ I * 3 + 1, 1) AS int) - one hundred 0-9
The SET @ tenth=CAST (SUBSTRING (@ s @ I * 3 + 2, 1) AS int)
The SET @ one=(CASE @ tenth the WHEN 1 THEN 10 ELSE 0 END) + CAST (SUBSTRING (@ s @ I * 3 + 3, 1) AS int) - bits 0-19
The SET @ tenth=(CASE WHEN @ tenth<=1 THEN 0 ELSE @ tenth END) - 10 9
0, 2 -IF (@ I=1 and @ 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 + ', '- one hundred is not zero plus connector 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' - a one hundred - bit is 0 the add connector and
IF @ hundreds> 0
The SET @ result=@ result + RTRIM (SUBSTRING (@ Numbers, @ hundreds * 10 to 9, 10)) + 'hundred'
IF @ tenth>=2 and @ tenth<=9
The BEGIN
IF @ hundreds> 0
SET @ result=@ result + 'and'
The SET @ result=@ result + RTRIM (SUBSTRING (@ Numbers, @ tenth * 10 + 171, 10))
END
IF @ one>=1 and @ one<=19
The BEGIN
IF @ tenth> 0
SET @ result=@ result + '-'
The ELSE
IF @ hundreds> 0
SET @ result=@ result + 'and'
SET @ result=@ result + RTRIM (SUBSTRING (@ Numbers, @ one * 10 to 9, 10))
END
IF @ I=0 and @ billion> 0
SET @ result=@ result + 'pull'
IF @ I=1 and @ million> 0
SET @ result=@ result + 'm letters'
IF @ I=2 and @ thousand> 0
SET @ result=@ result + 'thousand'
The SET @ I=@ I + 1
END
IF the SUBSTRING (@ s, 14, 2) & lt;> '00'
The BEGIN
SET @ result=@ result + 'point'
IF the SUBSTRING (@ s, 14, 1)='0'
SET @ result=@ result + 'zero'
The ELSE
SET @ result=@ result + RTRIM (SUBSTRING (@ Numbers, CAST (SUBSTRING (@ s, 14, 1) AS int) * 10 to 9, 10))
IF the SUBSTRING (@ s, 15, 1) & lt;> '0'
SET @ result=@ result + "+ RTRIM (SUBSTRING (@ Numbers, CAST (SUBSTRING (@ s, 15, 1) AS int) * 10 to 9, 10))
END
RETURN (@ result)
END

CodePudding user response:

refer to the second floor zlwa3 response:
 CREATE FUNCTION [dbo] [Num2eng] (@ num numeric (15, 2)) 
RETURNS a varchar (400) WITH ENCRYPTION
AS
The BEGIN
- All rights reserved. PBSQL
DECLARE @ I int, @ hundreds int, @ tenth int, @ one int
DECLARE @ thousand int, @ m letters int, @ $int
DECLARE @ Numbers varchar (400), @ s varchar (15), @ result varchar (400)
The SET @ Numbers='one, two three four five'
+ 'six, seven eight says ten'
+ '7-eleven's twelve thirteen fourteen fifteen'
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related