I want a function to convert a varchar to hexadecimal in sql server. Please help me.
P.S. I will use unhex() in Hive to try to get the original value back. This is because my data contains special characters and backslash and the HIVE external table does not recognise it
You can try to use CONVERT
function:
SELECT CONVERT(VARBINARY(MAX), 'myText')
Output:
0x6D7954657874
you can use
select try_convert(varbinary,varcharcolumn)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With