tsql中二进制到十六进制的转换 [英] Binary to hexadecimal conversion in tsql

查看:44
本文介绍了tsql中二进制到十六进制的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 CSharp 中,如果我这样做

In CSharp if I do

string binary = "10011101";
MessageBox.Show(Convert.ToInt32(binary, 2).ToString("X"));

我将得到输出为 9D.这是我可以用 CSharp 编写的最简单的代码,用于将二进制转换为十六进制.

I will get the output as 9D. This is the simplest code which I can write in CSharp for converting Binary to Hexadecimal.

是否有任何这样的方法在 SQL 中也做同样的事情(如果有的话,使用一些内置函数).是fn_varbintohexstr吗?

Is there any such way to do the same in SQL also(using some inbuilt function if any is available). Is it fn_varbintohexstr?

是否有任何按位运算有助于进行相同的转换.

Is there any bitwise operation which will help to do the same conversion.

谢谢

推荐答案

select master.sys.fn_varbintohexstr(@binvalue)

应该可以.

这篇关于tsql中二进制到十六进制的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆