Is there a local path function similar to a local name?

in a previous SO-mail: Argument 1 of an XML data type method "must be a string literal. I could not find a solution, but if someone can answer this question, I can solve this previous problem.

Question: how to get the full path to a given node so that I can get the name of this node?

declare @x xml; set @x='<ROOT><a>111</a></ROOT>'
SELECT @x.value('local-name((/ROOT/a)[1])', 'varchar(256)')

the above will return 'a'. How do I return '/ ROOT / a'?

+1
source share
1 answer

( SQL Server 2008) , SQL XQuery. , , FLWOR, , . .

, , (. SO) -

0

All Articles