mssql中十进制转换成十六进制字符串
2004-12-29 22:54
381 查看
ALTER function IntToHex(@i int)
returns varchar(20)
as
begin
declare @tmpint int
set @tmpint = @i
declare @result varchar(20)
set @result = ''
while @i <> 0
begin
set @tmpint = @i % 16
set @i = @i / 16
set @result = case @tmpint when 15 then 'F' when 14 then 'E' when 13 then 'D'
when 12 then 'C' when 11 then 'B' when 10 then 'A'
else ltrim(rtrim(str(@tmpint)))
end
+ @result
end
return @result
end
returns varchar(20)
as
begin
declare @tmpint int
set @tmpint = @i
declare @result varchar(20)
set @result = ''
while @i <> 0
begin
set @tmpint = @i % 16
set @i = @i / 16
set @result = case @tmpint when 15 then 'F' when 14 then 'E' when 13 then 'D'
when 12 then 'C' when 11 then 'B' when 10 then 'A'
else ltrim(rtrim(str(@tmpint)))
end
+ @result
end
return @result
end
相关文章推荐
- 将一个十六进制字符串转换为十进制数值的问题
- C语言将十六进制字符串转换成对应的十进制数字
- 十进制数字字符串转换成十六进制数字字符串方法
- 十六进制字符串转换为十进制数值
- 将一个十六进制字符串转换为十进制数值的问题
- 将一个十六进制字符串转换为十进制数值的问题
- 一个把十六进制字符串转换为十进制数字的函数
- 十进制字符串转换成十六进制字符串
- iOS -- 十进制、十六进制字符串,byte,data等之间的转换
- 将一个十六进制字符串转换为十进制数值的问题
- 将一个十六进制字符串转换为十进制数值的问题
- ios十进制、十六进制字符串,byte,data等之间的转换
- C语言中字符串如何转换为二进制、八进制、十进制、十六进制
- 将一个十六进制字符串转换为十进制数值的问题
- 将一个十六进制字符串转换为十进制数值的问题
- 将十六进制字符串转换成十进制数字
- VC中 十六进制字符串转换为十进制数字 转
- C语言将字符串转换成对应的数字(十进制、十六进制)
- IOS中常用的字符串、十进制、二进制、十六进制之间互相转换及简单算术和
- 将一个十六进制字符串转换为十进制数值