需要一个函数,使用SQL将十进制值转换为十六进制

时间:2022-01-30 17:08:28

With below convert statement i am able to get only the below result.

使用以下转换语句,我只能得到以下结果。

SELECT CONVERT(VARBINARY(MAX), '9133') 

result = 0x39313333

Is there any way to get the result as below.

有没有办法得到如下结果。

result = 0x0039003100330033

1 个解决方案

#1


1  

try like below for hexa conversion from decimal

尝试如下从十进制转换六进制

SELECT CONVERT(VARBINARY(8), 9133) as hexa_output 

   hexa_output
    0x000023AD

#1


1  

try like below for hexa conversion from decimal

尝试如下从十进制转换六进制

SELECT CONVERT(VARBINARY(8), 9133) as hexa_output 

   hexa_output
    0x000023AD