RocketSauce
asked on
XML query output question
I am toying around with 2 solutions to an xml report I have to generate. 1 way is via XML in SQL 2005.
I have this query below.
with xmlnamespaces ('uri' as tns)
select id as 'tns:id',
field1 as 'tns:field1',
field2 as 'tns:field2',
field3 as 'tns:field3',
field4 as 'tns:field4'
from reporting.xmlreport
where pid = 17591
for xml path('tns:TPO'), root('tns:Claim')
The output is fine except for the very first xml element
<tns:Claim xmlns:tns="uri">
This element should simply be
<tns:Claim >
How is this done? I know its a problem for how I am using the xml namespaces, but I can't find a way to use the namespace and not have that xmlns:tns="uri" part included.
I have this query below.
with xmlnamespaces ('uri' as tns)
select id as 'tns:id',
field1 as 'tns:field1',
field2 as 'tns:field2',
field3 as 'tns:field3',
field4 as 'tns:field4'
from reporting.xmlreport
where pid = 17591
for xml path('tns:TPO'), root('tns:Claim')
The output is fine except for the very first xml element
<tns:Claim xmlns:tns="uri">
This element should simply be
<tns:Claim >
How is this done? I know its a problem for how I am using the xml namespaces, but I can't find a way to use the namespace and not have that xmlns:tns="uri" part included.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.