日期:2014-05-17  浏览次数:20582 次

昨夜看到谁谁的数字转英文帖子, 咋不见了?!
做了两个函数,实现帖子上说的数字转英文.
当散分了!
SQL code
-- =============================================
-- Author:        Author,qianjin036a
-- Create date: Create Date,06/14/2008 02:27:17
-- Description:    Description,Arabic numerals to English
-- =============================================
CREATE FUNCTION Digit2English 
(
@arabia decimal(38,17)
)
RETURNS varchar(1000)
AS
BEGIN
    declare @atoe table(a int,e varchar(10))
    insert into @atoe select 0,'zero'    union all select 1,'one' 
       union all select 2,'two'            union all select 3,'three'
    union all select 4,'four'            union all select 5,'five'
    union all select 6,'six'            union all select 7,'seven'
    union all select 8,'eight'            union all select 9,'nine'

    declare @integer bigint,@trillion int,@billion int,@million int,@thousand int,@hundred int,@english varchar(1000)

    select @integer=@arabia,@english=''
    select @trillion=@integer % 1000000000000000/1000000000000,@billion=@integer % 1000000000000/1000000000,
        @million=@integer % 1000000000/1000000,@thousand=(@integer % 1000000)/1000,@hundred=(@integer % 1000)
    if @trillion>0
        set @english=@english + dbo.ThreeDigit(@trillion) + 'trillion '
    if @billion>0
        set @english=@english + dbo.ThreeDigit(@billion) + trust_bs,


------解决方案--------------------
sf
------解决方案--------------------
很强大.
------解决方案--------------------
强!
------解决方案--------------------

------解决方案--------------------
很强大
------解决方案--------------------
...................
------解决方案--------------------
收藏先
------解决方案--------------------
...
------解决方案--------------------
up
------解决方案--------------------
呵呵~~
------解决方案--------------------
支持

感谢分享
------解决方案--------------------
强悍
支持
分享

------解决方案--------------------
收藏
------解决方案--------------------
分~~