Pinal Dave in his post asked about the simple ways to convert hexadecimal values to decimal values.
Here are some methods:
87235 is an integer value whose hexadecimal is 0x000154C3.
In this case make use of Implicit conversion.
declare @hexa varbinary(10) set @hexa=0x000154C3 select @hexa as hexadecimal_value, @hexa*1 as integer_value
If the value is decimal, make use of CAST function
declare @hexa varbinary(10) set @hexa=0x060100019F4F0D00 select @hexa as hexadecimal_value, cast(@hexa as decimal(12,2)) as decimal_value
So for the safer side, it is always better to make use of CAST function
Tags: t-sql, sql_server, decimal, Hexadecimal,