November 8, 2011 at 8:04 pm
Comments posted to this topic are about the item Convert string Hex to Numeric with inline TSQL
August 8, 2012 at 8:11 am
A faster way to convert Hex to Dec is
select CAST(CONVERT(VARBINARY, 'FF00FF', 2) AS INT)
The string to convert must be at least 2 chars long :
select CAST(CONVERT(VARBINARY, 'F', 2) AS INT) : error
select CAST(CONVERT(VARBINARY, '0F', 2) AS INT) : 15
December 17, 2012 at 7:08 am
To convert fast from INT to HEX :
right(master.dbo.fn_varbintohexstr(cast( Disconnection_cause as INT) ),2)
January 18, 2013 at 4:09 am
Federico Iori (8/8/2012)
A faster way to convert Hex to Dec isselect CAST(CONVERT(VARBINARY, 'FF00FF', 2) AS INT)
The string to convert must be at least 2 chars long :
select CAST(CONVERT(VARBINARY, 'F', 2) AS INT) : error
select CAST(CONVERT(VARBINARY, '0F', 2) AS INT) : 15
the faster and faster:
select CONVERT(VARBINARY, 'fffe', 2)+0 --implicit cast
May 2, 2016 at 4:20 pm
Thanks for the script.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy