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)
 append to xml

Author  Topic 

magmo
Aged Yak Warrior

558 Posts

Posted - 2011-06-09 : 13:37:16
Hi

I have a xml column that is filled with xml data that is missing root elements, how can I add this to an exsisting stored procedure where I want to return the modified xml string? I tried this but it does not work.


, ('<root>' + dbo.TestTable.XmlInfo + '</root>')

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-06-09 : 13:52:37
Is it giving you an error message, or is it giving the wrong data? You may need to cast it to the correct data type at each stage, for example, like this:

cast('<root>' + cast(dbo.TestTable.XmlInfo as nvarchar(max)) + '</root>' as xml)
Go to Top of Page

magmo
Aged Yak Warrior

558 Posts

Posted - 2011-06-09 : 14:02:24
Hi

The cast made the trick, thank you very much!
Go to Top of Page
   

- Advertisement -