Column Value Conversion
I Have a table called Data and it has a column called Key which is of type varbinary.
The sample Values of that column are:
Key:
0x7F16D4BFA88C67E4F786DBC193C833DA
0x92CECEF9F5D6368CE4F2B0594B766775
Now i want to assign this value to a column called S_Key
in another table Final_Data
But the problem is S_Key
is of Datatype Varchar
.I tried convert and Cast but none of them seems to be working can anyone help me on this?
I did try this:
SELECT CONVERT(VARCHAR(100),0x3224CB7E4CEF0D2F6108ADFEA39BD233)
but it is giving me value like this:
2$Ë~Lï /aþ£›Ò3
You can try using the built-in sys.fn_sqlvarbasetostr
function to convert it to a hex-encoded string.
select master.dbo.fn_varbintohexstr([key])
from Data
精彩评论