金额小写转大写 sql函数 excel-vba fun
金额小写转大写 sql函数
1.
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
--功能: 用于将小写的数值翻译成大写的字符串(支持到分,即小数点后两位)
--入口参数:@decNum------数字型变量
--返回:字符串
--举例:select dbo.fn_ChnMoney(623.88)
-- 结果为“陆佰贰拾叁元捌角捌分”
ALTER FUNCTION [dbo].[fn_ChnMoney_New](@decNum decimal(18,2))
RETURNS varchar(200)
AS
BEGIN
DECLARE @chvNum varchar(200)
DECLARE @chvMoney varchar(200)
DECLARE @chvTemp varchar(200)
DECLARE @intIntLen int
DECLARE @intI int
DECLARE @chvTempI varchar(200)
DECLARE @chvReturn varchar(200)
DECLARE @sFsFlag int
SET @sFsFlag = 0
IF @decNum=0
SET @chvMoney = '零'
Else
BEGIN
IF @decNum<0
BEGIN
SET @sFsFlag = 1
SET @decNum = ABS(@decNum)
END
in the total catch, going to the front, front command, do a good job key and difficult problems to solve. County, a city office to give full play to the coordination, task decomposition, daily scheduling and supervision and evaluation functions, control version of < civilized city evaluation system >, detailed list of responsibilities, project work ledger, a clear timetable and roadmap, task book, staring at the key and difficult, do a good job and supervise the implementation. Comrade of the principal leaders of the county at all levels and departments to seriously directly to study the deployment and direct supervision of scheduling, to ensure that the implemented. Loopholes in the understanding to speak clearly, 3 propaganda to more widely. Propaganda the main purpose is to the public a city urban tree image, people get affordable truth, speak to understand a city every citizen should shoulder the responsibility and obligation to the broad masses of the people support, active participation, and consciously abide by. The county television, < today the state of Chu > to set up special column, reported in a timely manner to create work dynamics, propaganda of advanced models and the advanced experience of the civilized etiquette knowledge and civilized life common sense. At the same time, to a city of the dead, the public is not civilized behavior, working poor single bit to timely exposure. To make full use of traditional media and Internet, mobile phone text messages, floor Yu television and other new media, to carry out deep
SET @chvTemp=convert(varchar(200),Round(@decNum*100,0))
IF charindex('.',@chvTemp,1)>0
SET @chvNum=left(@chvTemp,charindex('.',@chvTemp,1)-1)
ELSE
SET @chvNum=@chvTemp
SET @intIntLen=len(@chvNum)
SET @chvMoney=''
Set @chvReturn = ''
SET @intI=1
WHILE @intI <= @intIntLen
BEGIN
SET @chvTempI = substring(@chvNum,@intIntLen-@intI+1,1)
SET @chvMoney = substring('零壹贰叁肆伍陆柒捌玖',convert(int,@chvTempI)+1,1) + substring('分角元拾佰仟万拾佰仟亿拾佰仟兆拾佰仟京拾佰仟',(@intI-1)+1,1)
SET @intI = @intI + 1
SET @chvReturn = @chvMoney + @chvReturn
END
END
SET @chvReturn=Replace(@chvReturn,'零仟','零')
SET @chvReturn=Replace(@chvReturn,'零佰','零')
SET @chvReturn=Replace(@chvReturn,'零拾','零')
while charindex('零零',@chvReturn,1)>0
SET @chvReturn=Replace(@chvReturn,'零零','零')
SET @chvReturn=Replace(@chvReturn,'零兆','兆')
SET @chvReturn=Replace(@chvReturn,'零亿','亿')
SET @chvReturn=Replace(@chvReturn,'零万','万')
SET @chvReturn=Replace(@chvReturn,'零元','元')
SET @chvReturn=Replace(@chvReturn,'零角零分','整')
SET @chvReturn=Replace(@chvReturn,'零角','零')
SET @chvReturn=Replace(@chvReturn,'零分','整')
SET @chvReturn=LTRIM(RTRIM(@chvReturn))
IF @sFsFlag = 1
in the total catch, going to the front, front command, do a good job key and difficult problems to solve. County, a city office to give full play to the coordination, task decomposition, daily scheduling and supervision and evaluation functions, control version of < civilized city evaluation system >, detailed list of responsibilities, project work ledger, a clear timetable and roadmap, task book, staring at the key and difficult, do a good job and supervise the implementation. Comrade of the principal leaders of the county at all levels and departments to seriously directly to study the deployment and direct supervision of scheduling, to ensure that the implemented. Loopholes in the understanding to speak clearly, 3 propaganda to more widely. Propaganda the main purpose is to the public a city urban tree image, people get affordable truth, speak to understand a city every citizen should shoulder the responsibility and obligation to the broad masses of the people support, active participation, and consciously abide by. The county television, < today the state of Chu > to set up special column, reported in a timely manner to create work dynamics, propaganda of advanced models and the advanced experience of the civilized etiquette knowledge and civilized life common sense. At the same time, to a city of the dead, the public is not civilized behavior, working poor single bit to timely exposure. To make full use of traditional media and Internet, mobile phone text messages, floor Yu television and other new media, to carry out deep
SET @chvReturn = '负' + Ltrim(@chvReturn)
RETURN @chvReturn
END
2.数字转换(不带 元角分 )
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
--功能: 用于将小写的数值翻译成大写的字符串(支持到分,即小数点后两位)
--入口参数:@decNum------数字型变量
--返回:字符串
--举例:select dbo.fn_ChnMoney(623.88) -- 结果为“陆佰贰拾叁元捌角捌分”
ALTER FUNCTION [dbo].[fn_ChnMoney](@decNum decimal(18,2)) RETURNS varchar(200)
AS
BEGIN
DECLARE @chvNum varchar(200)
DECLARE @chvMoney varchar(200)
DECLARE @chvTemp varchar(200)
DECLARE @intIntLen int
DECLARE @intI int
DECLARE @chvTempI varchar(200)
DECLARE @chvReturn varchar(200)
IF @decNum=0
in the total catch, going to the front, front command, do a good job key and difficult problems to solve. County, a city office to give full play to the coordination, task decomposition, daily scheduling and supervision and evaluation functions, control version of < civilized city evaluation system >, detailed list of responsibilities, project work ledger, a clear timetable and roadmap, task book, staring at the key and difficult, do a good job and supervise the implementation. Comrade of the principal leaders of the county at all levels and departments to seriously directly to study the deployment and direct supervision of scheduling, to ensure that the implemented. Loopholes in the understanding to speak clearly, 3 propaganda to more widely. Propaganda the main purpose is to the public a city urban tree image, people get affordable truth, speak to understand a city every citizen should shoulder the responsibility and obligation to the broad masses of the people support, active participation, and consciously abide by. The county television, < today the state of Chu > to set up special column, reported in a timely manner to create work dynamics, propaganda of advanced models and the advanced experience of the civilized etiquette knowledge and civilized life common sense. At the same time, to a city of the dead, the public is not civilized behavior, working poor single bit to timely exposure. To make full use of traditional media and Internet, mobile phone text messages, floor Yu television and other new media, to carry out deep
SET @chvMoney = '零'
Else
BEGIN
SET @chvTemp=convert(varchar(200),Round(@decNum*100,0))
IF charindex('.',@chvTemp,1)>0
SET @chvNum=left(@chvTemp,charindex('.',@chvTemp,1)-1)
ELSE
SET @chvNum=@chvTemp
SET @intIntLen=len(@chvNum)
SET @chvMoney=''
Set @chvReturn = ''
SET @intI=1
WHILE @intI <= @intIntLen
BEGIN
SET @chvTempI = substring(@chvNum,@intIntLen-@intI+1,1)
SET @chvMoney = substring('零壹贰叁肆伍陆柒捌玖',convert(int,@chvTempI)+1,1) + substring('分角元拾佰仟万拾佰仟亿拾佰仟兆拾佰仟京拾佰仟',(@intI-1)+1,1)
SET @intI = @intI + 1
SET @chvReturn = @chvMoney + @chvReturn
END
END
SET @chvReturn=Replace(@chvReturn,'零仟','零')
SET @chvReturn=Replace(@chvReturn,'零佰','零')
SET @chvReturn=Replace(@chvReturn,'零拾','零')
while charindex('零零',@chvReturn,1)>0
SET @chvReturn=Replace(@chvReturn,'零零','零')
SET @chvReturn=Replace(@chvReturn,'零兆','兆')
SET @chvReturn=Replace(@chvReturn,'零亿','亿')
SET @chvReturn=Replace(@chvReturn,'零万','万')
SET @chvReturn=Replace(@chvReturn,'零元','元')
SET @chvReturn=Replace(@chvReturn,'零角零分','整')
SET @chvReturn=Replace(@chvReturn,'零角','零') in the total catch, going to the front, front command, do a good job key and difficult problems to solve. County, a city office to give full play to the coordination, task decomposition, daily scheduling and supervision and evaluation functions, control version of < civilized city evaluation system >, detailed list of responsibilities, project work ledger, a clear timetable and roadmap, task book, staring at the key and difficult, do a good job and supervise the implementation. Comrade of the principal leaders of the county at all levels and departments to seriously directly to study the deployment and direct supervision of scheduling, to ensure that the implemented. Loopholes in the understanding to speak clearly, 3 propaganda to more widely. Propaganda the main purpose is to the public a city urban tree image, people get affordable truth, speak to understand a city every citizen should shoulder the responsibility and obligation to the broad masses of the people support, active participation, and consciously abide by. The county television, < today the state of Chu > to set up special column, reported in a timely manner to create work dynamics, propaganda of advanced models and the advanced experience of the civilized etiquette knowledge and civilized life common sense. At the same time, to a city of the dead, the public is not civilized behavior, working poor single bit to timely exposure. To make full use of traditional media and Internet, mobile phone text messages, floor Yu television and other new media, to carry out deep
SET @chvReturn=Replace(@chvReturn,'零分','整')
SET @chvReturn=LTRIM(RTRIM(@chvReturn))
RETURN @chvReturn
END
Excel vba 函数,数字转化成大写人民币
Function DXRMB(M)
'函数名为DXRMB
y = Int(Round(100 * Abs(M)) / 100)
j = Round(100 * Abs(M) + 0.00001) - y * 100
f = (j / 10 - Int(j / 10)) * 10
a = IIf(y < 1, "", Application.Text(y, "[DBNum2]") & "元")
b = IIf(j > 9.5, Application.Text(Int(j / 10), "[DBNum2]") & "角", IIf(y < 1, "", IIf(f > 1, "零", "")))
c = IIf(f < 1, "整", Application.Text(Round(f, 0), "[DBNum2]") & "分")
DXRMB = IIf(Abs(M) < 0.005, "", IIf(M < 0, "负" & a & b & c, a & b & c)) End Function
in the total catch, going to the front, front command, do a good job key and difficult problems to solve. County, a city office to give full play to the coordination, task decomposition, daily scheduling and supervision and evaluation functions, control version of < civilized city evaluation system >, detailed list of responsibilities, project work ledger, a clear timetable and roadmap, task book, staring at the key and difficult, do a good job and supervise the implementation. Comrade of the principal leaders of the county at all levels and departments to seriously directly to study the deployment and direct supervision of scheduling, to ensure that the implemented. Loopholes in the understanding to speak clearly, 3 propaganda to more widely. Propaganda the main purpose is to the public a city urban tree image, people get affordable truth, speak to understand a city every citizen should shoulder the responsibility and obligation to the broad masses of the people support, active participation, and consciously abide by. The county television, < today the state of Chu > to set up special column, reported in a timely manner to create work dynamics, propaganda of advanced models and the advanced experience of the civilized etiquette knowledge and civilized life common sense. At the same time, to a city of the dead, the public is not civilized behavior, working poor single bit to timely exposure. To make full use of traditional media and Internet, mobile phone text messages, floor Yu television and other new media, to carry out deep
本文档为【金额小写转大写 sql函数 excel-vba fun】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。