最简单的阿拉伯数字转大写(财务专用)
存储过程实现
在Sql Server2000和Sql Server2005测试通过
代码
1 create proc [dbo].[GetCapitalWords](@num bigint)
2 as
3 begin
4 declare @temp bigint,@index int,@returnWords varchar(8000),@capitalWords varchar(8000)
5 set @capitalWords='零一二三四五六七八九十'
6 set @returnWords=''
7 set @temp=@num
8 while @temp>0
9 begin
10 set @index=@temp%10+1
11 set @returnWords=substring(@capitalWords,@index,1)+@returnWords
12 set @temp=@temp/10
13 end
14 print @returnWords
15 end
16
17
18 exec GetCapitalWords 43027300660
19
20 --输出
21 --四三零二七三零零六六零