I have a query that I am trying to change to get a value from an xml string. This is what I have right now:
SELECT * FROM bench_request WHERE bench_request.start_date >= 'Mar 11 2022 8:59AM'
In my table I have a field called recurrenceinfo that contains an XML string. Here is an example of that field:
<RecurrenceInfo
Start="03/08/2022 08:00:00"
End="03/21/2022 08:00:00"
WeekDays="62"
Id="c46571d7-220f-4e75-ad7c-843e8868d63f"
Range="1"
FirstDayOfWeek="0"
Version="2"/>
What I am trying to do is get the start date from the xml string to use in replace of bench_request.start_date. So something like:
SELECT * FROM bench_request WHERE "Start from XML string" >= 'Mar 11 2022 8:59AM'
Basically I am trying to get all rows where the recurrenceinfo(Start) >= 'Mar 11 2022 8:59AM'.
I have searched and searched and can't figure it out. I have tried:
SELECT recurrenceinfo.query(N'/RecurrenceInfo/Start') AS [Start] FROM bench_request
But I get an error "Cannot find either column "recurrenceinfo" or the user-defined function or aggregate "recurrenceinfo.value", or the name is ambiguous."
How can I accomplish this? recurrenceinfo field is of type string, not xml. Also get the attribute start