This portal is to share my acquired knowledge related to Sql Server. I hope will be helpful for novice and professionals.

Friday, November 19, 2010

Apply Filter on XML column

If Object_ID ('tempdb..#tblXML') Is Not Null Drop Table #tblXML
Create Table #tblXML (Id Int, colXML XML)

Declare @XML XML
Set @XML =



Insert Into #tblXML
Select 1, @XML

Select *, colXML.value('(//@id)[1]','varchar(200)') As [XMLData]
From #tblXML
Where colXML.value('(//@id)[1]','varchar(200)') ='D3AB51B3-B3F8-4D5F-B928-F48EA2996EA6'

No comments: