I have the following xml in my database:
<email>
<account language="en" ... />
</email>
I'm using something like this now: but still have to find the attribute value
SELECT
convert(xml,m.Body).query('/Email/Account')
FROM Mail
How can i get the value of the language
attribute in my select statement with SQL?
This should work:
It depends a lot on how you're querying the document. You can do this, though:
EDIT after changes to your question.
Use XQuery:
Output: