Click here to Skip to main content
14,699,609 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello i am having a problem right now, i don't know if it is even possible to do in SQL,

i have a table that contains contacts this table for simplicity of example has 2 columns ID and XMLdata in the XMLdata column there is xml data for example: "<some long="" sutff="">>john<last name="">doesomething more>...

how can i search for name or last name of the column for XMLdata?

cause i can't use something like SELECT * FROM Contacts WHERE XMLdata LIKE '<name>%john%', and i need somethjing like that

is this possible to do?


What I understand from this stackoverflow question[^] (see the last answer[^]), you can cast your field to a XML data type[^] and use the value method[^] to retrieve the name.
I think you need to read XML and read particular node and process.

I will try to find more in to this.

Have a look at below link.

XML Support in Microsoft SQL Server 2005

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900