I store user preferences in an XML column which looks like this:
<tags>
<user>
<tag name="AB"/>
</user>
</tags/>
When I use the query below,
select *
from company
where CAST(tags.query('tags/user/tag[fn:contains(@name,"Ab")]') as varchar(2000) ) <> ''
it does not return any results, the attribute value is in different case then one in the xml column.
Any ideas on making the search by attribute name case insensitive?
Thanks
With SQL Server 2008 you can make use of the lower-case and upper-case functions like so:
see:
New XQuery functions introduced in SQL Server 2008: upper-case() and lower-case()
lower-case Function (XQuery) (MSDN)