create function UpperRMB(@num numeric(14,2))
returns @rmb table(
亿 varchar(2)
,仟万 varchar(2)
,佰万 varchar(2)
,拾万 varchar(2)
,万 varchar(2)
,仟 varchar(2)
,佰 varchar(2)
,拾 varchar(2)
,元 varchar(2)
,角 varchar(2)
,分 varchar(2))
as
begin
insert into @rmb
select
(case 亿1
when 0 then '零'
when 1 then '壹'
when 2 then '贰'
when 3 then '叁'
when 4 then '肆'
when 5 then '伍'
when 6 then '陆'
when 7 then '柒'
when 8 then '捌'
when 9 then '玖'
else '' end) as 亿,
(case 仟万1
when 0 then '零'
when 1 then '壹'
when 2 then '贰'
when 3 then '叁'
when 4 then '肆'
when 5 then '伍'
when 6 then '陆'
when 7 then '柒'
when 8 then '捌'
when 9 then '玖'
else '' end) as 仟万,
(case 佰万1
when 0 then '零'
when 1 then '壹'
when 2 then '贰'
when 3 then '叁'
when 4 then '肆'
when 5 then '伍'
when 6 then '陆'
when 7 then '柒'
when 8 then '捌'
when 9 then '玖'
else '' end) as 佰万,
(case 拾万1
when 0 then '零'
when 1 then '壹'
when 2 then '贰'
when 3 then '叁'
when 4 then '肆'
when 5 then '伍'
when 6 then '陆'
when 7 then '柒'
when 8 then '捌'
when 9 then '玖'
else '' end) as 拾万,
(case 万1
when 0 then '零'
when 1 then '壹'
when 2 then '贰'
when 3 then '叁'
when 4 then '肆'
when 5 then '伍'
when 6 then '陆'
when 7 then '柒'
when 8 then '捌'
when 9 then '玖'
else '' end) as 万,
(case 仟1
when 0 then '零'
when 1 then '壹'
when 2 then '贰'
when 3 then '叁'
when 4 then '肆'
when 5 then '伍'
when 6 then '陆'
when 7 then '柒'
when 8 then '捌'
when 9 then '玖'
else '' end) as 仟,
(case 佰1
when 0 then '零'
when 1 then '壹'
when 2 then '贰'
when 3 then '叁'
when 4 then '肆'
when 5 then '伍'
when 6 then '陆'
when 7 then '柒'
when 8 then '捌'
when 9 then '玖'
else '' end) as 佰,
(case 拾1
when 0 then '零'
when 1 then '壹'
when 2 then '贰'
when 3 then '叁'
when 4 then '肆'
when 5 then '伍'
when 6 then '陆'
when 7 then '柒'
when 8 then '捌'
when 9 then '玖'
else '' end) as 拾,
(case 元1
when 0 then '零'
when 1 then '壹'
when 2 then '贰'
when 3 then '叁'
when 4 then '肆'
when 5 then '伍'
when 6 then '陆'
when 7 then '柒'
when 8 then '捌'
when 9 then '玖'
else '' end) as 元,
(case 角1
when 0 then '零'
when 1 then '壹'
when 2 then '贰'
when 3 then '叁'
when 4 then '肆'
when 5 then '伍'
when 6 then '陆'
when 7 then '柒'
when 8 then '捌'
when 9 then '玖'
else '' end) as 角,
(case 分1
when 0 then '零'
when 1 then '壹'
when 2 then '贰'
when 3 then '叁'
when 4 then '肆'
when 5 then '伍'
when 6 then '陆'
when 7 then '柒'
when 8 then '捌'
when 9 then '玖'
else '' end) as 分
from (
select
case when len(ltrim(str(@num*100,14)))>=11
then convert(varchar(10),left(right(ltrim(str(@num*100,14)),11),1) ) else null end as 亿1,
case when len(ltrim(str(@num*100,14)))>=10
then convert(varchar(10),left(right(ltrim(str(@num*100,14)),10),1) ) else null end as 仟万1,
case when len(ltrim(str(@num*100,14)))>=9
then convert(varchar(10),left(right(ltrim(str(@num*100,14)),9),1) ) else null end as 佰万1,
case when len(ltrim(str(@num*100,14)))>=8
then convert(varchar(10),left(right(ltrim(str(@num*100,14)),8),1) ) else null end as 拾万1,
case when len(ltrim(str(@num*100,14)))>=7
then convert(varchar(10),left(right(ltrim(str(@num*100,14)),7),1) ) else null end as 万1,
case when len(ltrim(str(@num*100,14)))>=6
then convert(varchar(10),left(right(ltrim(str(@num*100,14)),6),1) ) else null end as 仟1,
case when len(ltrim(str(@num*100,14)))>=5
then convert(varchar(10),left(right(ltrim(str(@num*100,14)),5),1) ) else null end as 佰1,
case when len(ltrim(str(@num*100,14)))>=4
then convert(varchar(10),left(right(ltrim(str(@num*100,14)),4),1) ) else null end as 拾1,
case when len(ltrim(str(@num*100,14)))>=3
then convert(varchar(10),left(right(ltrim(str(@num*100,14)),3),1) ) else null end as 元1,
case when len(ltrim(str(@num*100,14)))>=2
then convert(varchar(10),left(right(ltrim(str(@num*100,14)),2),1) ) else null end as 角1,
case when len(ltrim(str(@num*100,14)))>=1
then convert(varchar(10),left(right(ltrim(str(@num*100,14)),1),1) ) else null end as 分1
) kk
return
end /*
select * from upperrmb(123456789.12) select 亿+'亿'+仟万+'仟'+佰万+'佰'+拾万+'拾'+万+'万'+仟+'仟'+佰+'佰'+拾+'拾'+元+'元'+角+'角'+分+'分' AS [人民币大写]
from upperrmb(123456789.12) --其实单位也可以在函数内设定
*/

sql 数字转人民币大写函数(两种方法)的更多相关文章

  1. SQL Server 批量插入数据的两种方法

    在SQL Server 中插入一条数据使用Insert语句,但是如果想要批量插入一堆数据的话,循环使用Insert不仅效率低,而且会导致SQL一系统性能问题.下面介绍 SQL Server支持的两种批 ...

  2. SQL Server 批量插入数据的两种方法(转)

    此文原创自CSDN TJVictor专栏:http://blog.csdn.net/tjvictor/archive/2009/07/18/4360030.aspx 在SQL Server 中插入一条 ...

  3. 转:SQL Server 批量插入数据的两种方法

    在SQL Server 中插入一条数据使用Insert语句,但是如果想要批量插入一堆数据的话,循环使用Insert不仅效率低,而且会导致SQL一系统性能问题.下面介绍SQL Server支持的两种批量 ...

  4. asp.net中TextBox只能输入数字的最简洁的两种方法

    如下TextBox <asp:textboxonkeypress="isnum()"id="TextBox1"runat="server&quo ...

  5. 数字转人民币大写(SQL SERVER)

    --数字转人民币大写NumToRMB ---新建方法create  FUNCTION dbo.NumToRMB (@num numeric(14,5))   RETURNS varchar(100) ...

  6. C++关于数字逆序输出的两种思路,及字符串逆序输出

    C++关于数字逆序输出的两种思路,及字符串逆序输出 作者:GREATCOFFEE 发布时间:NOVEMBER 15, 2012 分类:编程的艺术 最近在跟女神一起学C++(其实我是不怀好意),然后女神 ...

  7. EntityFramework Core 2.0自定义标量函数两种方式

    前言 上一节我们讲完原始查询如何防止SQL注入问题同时并提供了几种方式.本节我们继续来讲讲EF Core 2.0中的新特性自定义标量函数. 自定义标量函数两种方式 在EF Core 2.0中我们可以将 ...

  8. 【PHP】数字补零的两种方法

    在php中有两个函数,能够实现数字补零, str_pad() sprintf() 函数1 : str_pad 顾名思义这个函数是针对字符串来说的这个可以对指定的字符串填补任何其它的字符串 例如:str ...

  9. SQL Server 2008 数据库同步的两种方式 (发布、订阅)

    参考转载: SQL Server 2008 数据库同步的两种方式 (发布.订阅) 使用Sqlserver事务发布实现数据同步

随机推荐

  1. iOS 关于UIWindow的理解

    Every iOS app has a window that handles the presentation of the app’s user interface. Although the w ...

  2. irc操作小记

    IRC客户端 HexChat 跨平台支持,目前正在Windows上使用,暂无不满意的地方 polari 支持的命令太少了,功能有限. Empathy 重量级,支持各种消息协议 weechat/irss ...

  3. WIZnet官方网盘

    之前使用过 WIZnet 的TCP/IP 解决方案,资源较少, 偶然发现此网盘,不敢独享,访问 请戳此处.

  4. FIX_前缀后缀_未提交

    问题 B: FIX 时间限制: 1 Sec  内存限制: 64 MB提交: 38  解决: 11[提交][状态][讨论版] 题目描述 如果单词 X 由单词 Y 的前若干个字母构成,我们称 X 是 Y ...

  5. jquery stop( ) 的用法 (转)

    目的:为了 了解stop()的用法,举个例子,直观的方式看看. 实物:一个id="animater"的div包含了一段文字.(以下用animator表示实物) 动画最终的完整效果: ...

  6. Volley与XUtils网络请求使用对比,心得,两者基本使用

    之前一直使用的Volley作为网络请求框架,它是Google 在2013年的I/O大会 上,发布的.Volley是Android平台上的网络通信库,能使网络通信更快,更简单,更健壮,同时扩展性很强.在 ...

  7. 最喜欢的VS 键盘快捷键摘抄

    最喜欢的Visual Studio键盘快捷键(关闭)   336年最喜欢的 425年 你最喜欢的Visual Studio键盘快捷键是什么? 我总是让我的手在键盘上,远离鼠标! 一个请每回答. net ...

  8. storyboard pushViewController 的时候,新的界面黑屏

    storyboard 创建的一级界面需要通过代码跳转到另一 storyboard 创建的界面的时候,通常我们会这样 其实 alloc init 相当于重新创建一个界面,所以我们 push 进入之后会发 ...

  9. The Triangle

    针对如下形式的ACM试题,大多出自南阳理工学院的在线ACM试题(网址: 南阳理工在线评测系统),在此非常感谢,同时也非常感谢作者的分享! 时间限制:1000 ms  |  内存限制:65535 KB ...

  10. OpenCv,EmguCv及.net之间的互动(The Interaction of OpenCv, EmguCv AND .net)

    http://www.cnblogs.com/xrwang/archive/2010/01/26/TheInteractionOfOpenCv-EmguCvANDDotNet.html 前言 在.ne ...