Skip to content
Advertisement

SQL – Cast Column as XML then Query Value from said column

I have a column with a bunch of unformatted XML code. I am trying to really just query 1 value out of the column. The value inside of the column is listed below:

The value that I am looking for is displayValue=”NSharePoint Read Item” which is located in the line:

I have the following query:

which I have been using to try and pull any value out of the column, but everything is returning NULL, regardless of what I try.

Looking for any help, thank you!

Advertisement

Answer

Please try the following solution. It is for MS SQL Server.

Amazingly enough, the provided XML has no namespaces. Though it was an attempt to use a namespace.

SQL

Output

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement