Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Handling xml in sql /converting xml to varchar

Author  Topic 

sujithukvl@gmail.com
Starting Member

22 Posts

Posted - 2011-04-26 : 01:07:47
quote:

--------+-------------------------------------------------------
int |xml
--------+-------------------------------------------------------
2 |<items>
| <item>
| <description>item 21 </description>
| </item>
| <item>
| <description>item 22</description>
| </item>
|</items>
--------+-------------------------------------------------------
3 |<items>
| <item>
| <description>item 31 </description>
| </item>
|</items>
--------+-------------------------------------------------------
4 |<items>
| <item>
| <description>item 31 </description>
| </item>
| <item>
| <description>item 32</description>
| </item>
| <item>
| <description>item 33</description>
| </item>
|</items>
--------+-------------------------------------------------------

I have a table as in the above structure and type, I have to convert it to the structure and type as below

--------+-------------------------------------------------------
int |varhcar
--------+-------------------------------------------------------
2 | item 21
--------+-------------------------------------------------------
2 | item 22
--------+-------------------------------------------------------
3 | item 31
--------+-------------------------------------------------------
4 | item 41
--------+-------------------------------------------------------
4 | item 42
--------+-------------------------------------------------------
4 | item 43
--------+-------------------------------------------------------


   

- Advertisement -