转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 数据库 >> SyBase >> 正文
献个丑,写了个小写转大写的sp ,0.1 版本继续测试中         ★★★★

献个丑,写了个小写转大写的sp ,0.1 版本继续测试中

作者:闵涛 文章来源:闵涛的学习笔记 点击数:1836 更新时间:2009/4/22 23:09:37
p; = ltrim(rtrim(@result)) 
end 

--去最后一个零 
if @result like '%零' 
begin 
  select @result   = substring( @result ,  1,datalength(@result)-2) 
  select @result   = ltrim(rtrim(@result)) 
end 
select @result    
end

 zhangyh123 回复于:2003-09-23 11:39:39 请大家帮助测试看看     并希望给更好的方案

 zhangyh123 回复于:2003-09-23 14:23:47 测试用例子 
  
sp_convertmoney 0.05   伍分
sp_convertmoney 0.45   肆角伍分
sp_convertmoney 1.45  壹元肆角伍分
sp_convertmoney 1.00   壹元整
sp_convertmoney 1.01  壹元零壹分
sp_convertmoney 10.01  壹拾元零壹分
sp_convertmoney 10.81 壹拾元捌角壹分
sp_convertmoney 190.81  壹佰玖拾元捌角壹分
sp_convertmoney 100    壹佰元整
sp_convertmoney 100.01   壹佰元零壹分
sp_convertmoney 1000.10  壹仟元壹角
sp_convertmoney 10000  壹万元整
sp_convertmoney 10000.02 壹万元零贰分
sp_convertmoney 1030000  壹佰零叁万元整
sp_convertmoney 1030000.99 壹佰零叁万元玖角玖分
sp_convertmoney 10000000.01 壹仟万元零壹分
sp_convertmoney 10000000 壹仟万元整
sp_convertmoney 100000000 壹亿元整
sp_convertmoney 100000100 壹亿零壹佰元整

负数没有考虑 


如果是0 ,自己可以加一句判断 ,怎么返回看自己要求
if @convmoney =0  
begin
  select '零元整'
  return 
end

 liugr3988 回复于:2003-09-23 16:13:04 很好,顶!

 Blackrose 回复于:2003-09-23 21:50:08 A.
1> sp_convertmoney  0.111
2> go
Msg 241, Level 16, State 2:
Server 'LOCAL', Procedure 'sp_convertmoney':
Scale error during implicit conversion of NUMERIC value '0.111' to a NUMERIC
field.

是不是考虑添加一点四舍五入(可以选择)的功能,或者一点容错...
B.
最大好像就是 
玖拾玖亿玖仟玖佰玖拾玖万玖仟玖佰玖拾玖元玖角玖分

不错,算法没有仔细看,功能还是good!!!!

 zhangyh123 回复于:2003-09-24 09:17:41 [quote:96e79aae65="Blackrose"]A.
1> sp_convertmoney  0.111
2> go
Msg 241, Level 16, State 2:
Server 'LOCAL', Procedure 'sp_convertmoney':
Scale error during implicit conversion of NUMERIC value '0.111' to a NUMERIC
fie..........[/quote:96e79aae65]     

第一  输入必须自己格式化为 numeric(12,2)数据类型。这个是调用的时候出错,不是内部错误。  
第二 如果需要更大的可以将程序略改一点,增加一下位数,以及临时表的记录就可以了
我最多用到千万的说 

 jazy 回复于:2003-09-24 12:58:04 想法不错,支持一下!!

 chenfeng825 回复于:2003-09-24 13:03:57 呵呵。jazy好久没见来了。

 

上一页  [1] [2] 


[Delphi程序]Rave Report中文版插件 V0.1  [Web开发]ShadowStar Fast Editor V0.1
[MySql]Linux网络服务软件安装备忘录 ver 0.1  
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · Sql Server  · MySql
    · Access  · ORACLE
    · SyBase  · 其他
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台