I'm using Yellowfin which connects to a SQL 2012 database. Within a table there is a column called EnteredXML which contains full XML from a web submission, so a sub table of XML type within the column. From the XML column I want to obtain a specific value from the column called CoverRateSelection.
I've tried the following:
SELECT
MemberNo,
TransTypeID,
EnteredXML.value('(/MembershipApplication/Cover/CoverRateSelection/@value)[1]', 'varchar(max)')
FROM
V204241Webtransactions
WHERE
TransTypeID = 'MemAp'
The response I get from this is
SQL statement is invalid.
The error message returned from the database was:
Cannot find either column "EnteredXML" or the user-defined function or aggregate "EnteredXML.value", or the name is ambiguous.
the table looks like this:
The XML looks like this (I've removed personal info):
I got this far using other posts at stackoverflow:
how-to-get-a-particular-attribute-from-xml-element-in-sql-server
extracting-attributes-from-xml-fields-in-sql-server-2008-table
reading-xml-that-is-saved-as-text-from-sql
but I'm now a bit lost and confused. Any help would be greatly appreciated.
Thanks
Chris