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. It's 100% free, no registration required.

I am expecting this query to output rows which has 'xyz' in xml column 'col' anywhere. But it returns all rows.(when i checked it returns all rows having 'x' in xml column. So please tell me why does it happen?where i am going wrong?Also please correct it.

Also i have another problem where below query for the same above xml does not return any output.I expect it to return xml column having 'xyz' anywhere in it.So please have a look at it also and correct my errors.

Ok.But the @id may have any number of characters in my case so how it can be handled.Should i use varchar(max)?
–
IT researcherJun 22 '13 at 9:27

1

@ITresearcher Unless it is enough with a varchar(63) you can use varchar(max).
–
Mikael ErikssonJun 22 '13 at 9:42

1

@ITresearcher why would you need the [@id] variable / the [user] node being varchar(max)? Do you really want to search in the XMLs by a key that can be up to 2 GB large (max)? What's the real size for your data there?
–
MarianJun 22 '13 at 22:08