Sybase从XML字段选择值
我有一个名为data_values以以下格式存储在SYBASE中的表:
data1 | data2 | data3 | value
值字段具有以下XML格式:
<T key1=value1 key2=value2 .... keyn=valuen /T>
我想从值1,Value1,value2等的值字段值中进行选择。但是我找不到正确的查询。这。
我尝试过:
SELECT value.value('(/T//value1/node())[1]', 'varchar(255)') as value1 from data_values
我认为价值是一个保留的关键字,我需要以某种方式逃脱它。 我尝试过的其他事情是一个值。Query函数在Sybase中不起作用。 另外,我对Sybase非常陌生,并且在复杂的SQL查询中没有很多工作。
I have a table named data_values stored in SYBASE in the following format:
data1 | data2 | data3 | value
The value field has the following XML format:
<T key1=value1 key2=value2 .... keyn=valuen /T>
I want to select from the value field values like value1, value2, etc. but I can't find a correct query to do this.
I have tried:
SELECT value.value('(/T//value1/node())[1]', 'varchar(255)') as value1 from data_values
also value is a reserved keyword I think and I need to escape it somehow.
Other things I have tried is a value.query function which didn't work in Sybase.
Also, I am pretty new to Sybase and didn't work a lot with complex sql queries.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要在Sybase ASE中提取标签以下Xmlextract函数:
例如,key1和value1:
在哪里要返回的数据类型(int,float,varchar等),而值是xml列的名称。
To extract a tag in Sybase ASE the following xmlextract function can be used:
e.g for key1 and value1 :
Where is the type of the data you want to return ( INT, FLOAT, VARCHAR, ETC) and value is the name of the XML column.