Basically I have a column named XML
that is of type TEXT
; this cannot be changed for other reason, but I was wondering how I could cast it to XML.<
Have you tried CONVERT
instead of CAST
?
SELECT CONVERT(XML, @xml).value('(/Record/UserGuid)[1]', 'NVARCHAR(max)')
from tbl_Module_RequestForms_Items
Also, check out the "xml styles" section of this page; it contains some options you have when converting xml:
http://msdn.microsoft.com/en-us/library/ms187928.aspx