我在TSQL中有一个包含十六进制列的数据库。然而,这些值填充零以填充列。
我需要删除这些零,这样我才有十六进制字符串。问题是我不能只删除零对,因为字符串可能在零中间。
我有一种感觉,我需要将它转换为十进制,然后返回或者其他东西,但是我尝试的所有东西都会产生奇怪的结果。
数据库中的列看起来像这样:
1EBC67E6000000 6B1FE9C7830000 C700DBBF000000值是不同的长度,所有填充零对。
任何想法都会很好!
解决 选择替换(rtrim(replace('C700DBBF000000')) ,'0','')),'','0');
I have a database in TSQL that contains columns in hexadecimal. However these values are padded with zeroes to fill the column.
I need to remove these zeroes just so I have the hexadecimal string. The problem is I cannot just remove pairs of zeroes as the string may have zeroes in the middle.
I have a feeling I need to convert it to say decimal and then back or something, but everything I try yields strange results.
The column in the database look like this:
1EBC67E6000000 6B1FE9C7830000 C700DBBF000000The values are different lengths and all padded with pairs of zeroes.
Any ideas would be good!
解决方案Maybe this will be good for you:
Select replace(rtrim(replace('C700DBBF000000','0',' ')),' ','0');
更多推荐
在十六进制列中删除填充的零
发布评论