开发者

Column Value Conversion

开发者 https://www.devze.com 2023-02-12 05:10 出处:网络
开发者_开发技巧I Have a table called Data and it has a column called Key which is of type varbinary.
开发者_开发技巧

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
0

精彩评论

暂无评论...
验证码 换一张
取 消