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 2012 Forums
 Other SQL Server 2012 Topics
 Type casting from XML to Varchar

Author  Topic 

shwetha
Starting Member

1 Post

Posted - 2011-03-29 : 03:05:46
hi,
i have cretaed the view for a table.one field is of XML data type.
when am using distinct while selecting all the fields from the view , its throwing error.Please help me to type cast the XML data type to varchar.

Thanks in advance
Shwetha

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-03-29 : 07:27:34
You can cast it to varchar(max) and then do distinct as in
select distinct cast(YourXMLColumn as varchar(max)) from YourTable
Go to Top of Page
   

- Advertisement -