我正在使用 Sybase ASE 15.0.2 尝试以下操作,但发现很难通过:
动机是提取 <tables> 标签的内容。有人可以帮我解决这个问题吗?
declare @purgeTableInfo varchar(16300)
select @purgeTableInfo =
'<purge>
<start-time>00:00:000</start-time>
<end-time>03:00:000</end-time>
<tables>
<table>
<table_name>table1</table_name>
<owner>dbo</owner>
<columns>
<column>
<column_name>column1</column_name>
<column_value>121212xdfsdsdsdsd</column_value>
<column_condition>like</column_condition>
</column>
<column>
<column_name>column2</column_name>
<column_value>121212xdfsdsdsdsd</column_value>
<column_condition>like</column_condition>
</column>
</columns>
</table>
</tables>
</purge>'
select *
from xmltable('/purge/tables/table/columns/column'
passing @purgeTableInfo
columns columnName varchar(255) path 'column_name',
tableName varchar(255) pattern '../../table_name') as purgeInputDetails