soozh
asked on
SQL statement to produced xml of table
i am trying to produce an xml from a table and i am having trouble when trying to include column values as child nodes.
The table has many columns but I am having trouble with four columns that have to be nested in a child node. These are the columns and they are all of type bit.
They are:
[RiskInflam]
[Vascularisation]
[Glaucoma]
[RiskAnnan]
I need to produce the xml in the format
<RiskFactors>
<RiskFactor></RiskFactor>
</RiskFactors>
So when the row has the following values:
[RiskInflam] 1
[Vascularisation] 0
[Glaucoma] 1
[RiskAnnan] 0
I need to produce:
<RiskFactors>
<RiskFactor>RF_RiskInflam< /RiskFacto r>
<RiskFactor>RF_Glaucoma</R iskFactor>
</RiskFactors>
This is embedded in an xml document with other columns.
<LS2ECCTR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Version>1</Version>
<LS-ID>1234567890</LS-ID>
…. Risk factors…..
</LS2ECCTR>
I am not sure of the sql/xml syntax to produce this. Can anyone help?
The table has many columns but I am having trouble with four columns that have to be nested in a child node. These are the columns and they are all of type bit.
They are:
[RiskInflam]
[Vascularisation]
[Glaucoma]
[RiskAnnan]
I need to produce the xml in the format
<RiskFactors>
<RiskFactor></RiskFactor>
</RiskFactors>
So when the row has the following values:
[RiskInflam] 1
[Vascularisation] 0
[Glaucoma] 1
[RiskAnnan] 0
I need to produce:
<RiskFactors>
<RiskFactor>RF_RiskInflam<
<RiskFactor>RF_Glaucoma</R
</RiskFactors>
This is embedded in an xml document with other columns.
<LS2ECCTR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Version>1</Version>
<LS-ID>1234567890</LS-ID>
…. Risk factors…..
</LS2ECCTR>
I am not sure of the sql/xml syntax to produce this. Can anyone help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.