Thursday, March 8, 2012

about XML View Function.

I Know that we can show the view that it is made by Singleton XML Schema.

But I want to show a view what it is made by NO Singleton XML Schema.

Please let me know that if you have any knowledges.

Thanks for you.

just try it like this

Content of XML-Field:

<MyParameters>

<Parameter>

<ParaNr></ParaNr>

<ParaText></ParaText>

</Parameter>

<Parameter>

<ParaNr></ParaNr>

<ParaText></ParaText>

</Parameter>

<Parameter>

<ParaNr></ParaNr>

<ParaText></ParaText>

</Parameter>

</MyParameters>

Statement for the Query (My_ID is just another nonXML column of the table):

SELECT MY_ID

ref.value('./ParaNr', 'nvarchar(2)') AS [PARA_NR],

ref.value('./ParaText', 'nvarchar(200)') AS [PARA_TEXT]
FROM MY_SCEMA.MY_TABLE

CROSS apply MY_XMLCOLUMN.nodes('/MyParameters/Parameter') AS T (ref)

I Hope this helps

best regards

Raimund

No comments:

Post a Comment