Thursday, January 15, 2009

[SQL] A very easy way to convert tinyint to hex


SELECT CONVERT(VARBINARY(1), 254)
0xFE


If you need more leading zeroes, raise the size of the Varbinary.


SELECT CONVERT(VARBINARY(8), 254)
0x000000FE

No comments: