ALTER FUNCTION INTTOHEX (@i int) returns varchar (20) asbegindeclare @tmpint Int
Set @tmpint = @ideclare @Result varchar (20) set @Result = ''
While @i <> 0 begin set @tmpint = @i% 16 set @i = @i / 16
Set @Result = Case @Tmpint When 15 TEN 'F' WHEN 14 TEN 'E' WHEN 13 TEN 'D' WHEN 12 TEN 'C' WHEN 11 TEN 'B' WHEN 10 TEN 'A' ELSE LTRIM (RTRIM (STR @TMPINT)))) End @Result
end
Return @Resultend