Does anyone know how to build a dynamic query with a dynamic WHERE clausel
(which also may be empty) in a "for xml EXPLICIT" statement?
I mean something like ...

select 10 as Tag,
null as Parent,
null as [DATA!10],

Union All

select 20, -- as Tag,
10, -- as Parent,
'Blah', -- as [DATA!10],
where ID = @id // and maybe some more conditions

for xml EXPLICIT

Maybe it would be nice to have also a dynamic ORDER BY clause.

Thanks for any good ideas about it!!!