十六进制到ASCII字符串的转换 [英] Hex to ASCII string conversion on the fly

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

问题描述

我很想知道是否有可能读取包含十六进制值的表的记录并将其即时转换为字符串数据类型,然后再显示/将它们用作结果(例如在示例图片中,其中原始数据显示在左侧,程序如何解释它的右侧).

I am interested to know if there is a possibility to read the records of a table containing hexadecimal values and convert them on-the-fly into string datatype before displaying / using them as a results (like on the example picture, where the raw data is displayed on the left and how the program interprets it on the right portion).

数据来自MS Dynamics导航v5(SP1)ERP软件...

另外,我想知道是否有可能设置一个条件(例如,哪里)可以键入为字符串(例如,在哪里'em> 像'OS%')和DBMS是否可以将其转换为十六进制并在表中搜索以缩小查询的最终结果.

Additionally, I would like to know if there is a possibility of setting a condition (e.g. where) that could be typed as a string (e.g. where something like 'OS%') and DBMS could convert it to hex and search for it in a table to narrow down the end results of a query.

在此先感谢大家.

推荐答案

根据您的信息,此列来自Microsoft Dynamics导航,听起来确实很清楚.

According to your information, that this column is from Microsoft Dynamics NAV it sounds really clear.

MSDN文档表示了这一点:

指定链接附加到的记录.

Specifies the record that the link is attached to.

使用以下语法:

<表名> ;:<主键1>,<主键2>,<主键3>

我很确定,Microsoft为此值提供了一个组合模式,这有点奇怪,但是我想起来并不难.

I'm pretty sure, Microsoft has a combined schema for this value, which is a bit strange but well not that hard to fiddle out I think.

如果将值分割为 FF ,则可以看到两个结果:

If you split your values up to the FF, you can see two results:

--0xB6A1E6050089FF4252412D4D3032000000
select convert(int,0xB6A1E6050089FF) -- Object_ID for the specified table
select convert(varchar(100),0x4252412D4D3032000000) -- Primary Key 1

您可以尝试进一步并在您的计算机上执行此操作:

You can try to take this further and execute this on your machine:

select object_name(convert(int,0xB6A1E6050089FF))

这应该给您一个有效的表名.希望.;-)

This should give you a valid table name. Hopefully. ;-)

由于我没有安装这些系统,所以我不能自己检查这一点.如果是这样,我可以在此结果中添加一条简短的命令,以自动为您进行拆分.

I can't check this on my side, as I havent those system installed. If so, I can add a short command to this result to automate the splitting for you.

您的其他字符串可以这样分割:

Your other string can be splitted like this:

--0x1E150000008B000000000089FF534F3030303133353532000087102700000000
SELECT convert(int,0x1E150000008B000000000089FF) -- 35327 (object_id)
SELECT convert(varchar(100),0x534F30303031333535320000) -- SO00013552
SELECT convert(int,0x87102700000000) -- 0

我认为,您需要动态解析它.您应该检查基表(第一部分).之后,检查主键的顺序.选中此选项后,您可以将它们动态解析为它们的目标格式.唯一可能会更困难的是拆分的一部分.通常,第一部分应该一直到 FF .之后,每个部分都可以被多个零分割.

I think, you need to parse it dynamically. You should check the basetable (the first part). After that, check the primary keys in their ordering. After checking this, you can dynamically parse them into their target format. The only thing, which may be a bit harder, is the part of the splitting. Normally the first part should go until the FF. After that each part can be splitted by multiple zeros.

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

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