Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using sql server 2008 r2 express. I have a table with column name 'xmlmycolumn' which is of datatype xml. I want to search for string in that whole xml. So to do this i am casting column as varchar and then i use charindex as shown below.

FROM mytable
WHERE ( Charindex('abc',CAST([xmlmycolumn] AS VARCHAR(MAX)))>0 ) 

Is there any other method other than casting the column as varchar so that performance of the query is increased?

share|improve this question
Have a look at Use Full-Text Search with XML Columns. – Mikael Eriksson Jun 21 '13 at 8:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.