Question

I'm using an Xml field in my Sql Server database table. I'm trying to search a word using the XQuery contains method but it seems to search only in case sensitive mode. The lower method isn't implemented on Sql Server XQuery implementation also. ¿Is there a simple solution to this problem?

Was it helpful?

Solution

If you're using SQL Server 2005, I'm afraid you're out of luck.

If you're using SQL Server 2008, you can use the upper-case function like this :

DECLARE @x xml = N'abcDEF!@4';
SELECT @x.value('fn:upper-case(/text()[1])', 'nvarchar(10)');

Here's a link on MSDN for the upper-case syntax and a couple search examples :

http://msdn.microsoft.com/en-us/library/cc645590.aspx

OTHER TIPS

First link from google points to MSDN page:

contains Function (XQuery)

In order to get case-insensitive comparisons, the upper-case or lower-case functions can be used.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top