Posted on 2009-04-10
This is a very basic XML question, but I have yet to find a simple, easy to understand solution. I have an application that contains images. There is a SQL Server 2008 database which contains an Images table. The Images table contains an XML data attribute called "Tags". This contains an XML document like the following:
What I want to do is query the Tags column for all the rows in the Images table. For example, I want to find all images that have a tag of "Green". How would I write the TSQL code to do this? Idealy, I want the selection to return the ImageID of the matching rows that contain the desired tag values.