MySQL Forums
Forum List  »  Microsoft SQL Server

Re: Local-name() in XML from MSSQL to MySQL
Posted by: Trung Tran
Date: March 18, 2022 07:05AM

Sorry that I input the wrong query,

The full query is as followed:

with cte as (select convert(xml,'<Attributes>
<Map>
<entry key="trigger" value = "action">
<value>
<Map>
<entry key=" Processing">
<value>
<Boolean>true</Boolean>
</value>
</entry>
</Map>
</value>
</entry>
</Map>
</Attributes>') as attributes)
select entr.value('@key','nvarchar(100)') AS AttrKey
,entr.value('@value','nvarchar(500)') AS AttrValue
,HasValueElement.value('local-name(.)','nvarchar(100)') AS ValueType
FROM cte a1
cross apply a1.attributes.nodes(N'/Attributes/Map/entry') A(entr)
OUTER APPLY A.entr.nodes(N'value/*') B(HasValueElement)

Options: ReplyQuote


Subject
Written By
Posted
Re: Local-name() in XML from MSSQL to MySQL
March 18, 2022 07:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.