Ten-based ten in MSSQL into hexadecimal strings

xiaoxiao2021-03-06  43

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

转载请注明原文地址:https://www.9cbs.com/read-75061.html

New Post(0)