Credits:
Description
Code
|
|
Cool Tips > Data Conversion >
Data Conversion - Convert HEX to BIGINTCredits:Author: Various (incl. Pinal Dave and the original 2000/5 from PDreyer
Date: 9 Jul 2008
DescriptionWhen I went to publish this tip, I looked at the code i had stored and something didn't seem quite right. It had become corrupted over the years. I searched out a much better function-based version which is published below and is valid for all versions of SQL Server.
However, from SQL 2008 onwards, the CAST/CONVERT functions are able to perform this conversion directly, with the HEX represented as either a VARBINARY token, or a HEX character string with or without the '0x' prefix.
Code
|