For Xml Multiple Control By Attribute In Tree Concept
I want to figure out one issue. I already had question about simple ordering issue but I want to order more detail. check below this link : SQL Server : FOR XML sorting control by
Solution 1:
select @data.query('
element Main {
for $s in Main/Sample
return element Sample {
$s/@*,
for $n in $s/Node
return element Node {
for $i in Node/*
order by $i/@order
return
if ($i/self::tree)
then element tree { $i/@testid }
else element tree-order { $i/@testid }
}
}
}
}')
Solution 2:
What's interesting to me is that in your original post, you're stating that you're generating the XML as the result of a SQL query. If it were me, I'd control the ordering at that level.
Post a Comment for "For Xml Multiple Control By Attribute In Tree Concept"