I have some base-64 encoded strings in SQL Server database, for example:
DECLARE @x VARBINARY(64);
SET @x = 0x4b78374c6a3733514f723444444d35793665362f6c513d3d
When it's CAST or CONVERTED to a VARCHAR, I get:
+˽Ð:¾Îréî¿•
I'm looking for SQL Server to return a varchar with the hexadecimal representation of the varbinary as a varchar, e.g.:
4b78374c6a3733514f723444444d35793665362f6c513d3d
Is there a build in CAST/CONVERT/function that does this, or does it have to be added as a User Defined Function? And what would the UDF be?
Bonus points if I can select whether I want capital A-F or lower case a-f in the conversion process.