I'm trying to generate a SQL query to get the "DATE" values out of the following SQL XML:
I've tried something like this but I don't think I'm understanding the concepts.
select
xConfig.value('(/SearchjobConfig/QueryString/SearchCriteria/ExpressionSet/SimpleAttributeExpression) [1]','nvarchar(max)')
from
Job
Here is the XML as text:
<SearchJobConfig>
<QueryID>1072</QueryID>
<QueryString>
<SearchCriteria name="Search query" >
<ExpressionSet logicalOperator="AND">
<SimpleAttributeExpression displayName="Date" npmPropertyId="4" searchOperation="GREATER_EQUAL" dataType="string" caseSensitive="false">2019-06-01T04:00:00</SimpleAttributeExpression>
<SimpleAttributeExpression displayName="Date" npmPropertyId="4" searchOperation="LESS_EQUAL" dataType="string" caseSensitive="false">2019-06-13T03:59:59</SimpleAttributeExpression>
<SimpleAttributeExpression displayName="Class" npmPropertyId="1056" searchOperation="EQUALS" dataType="int32" caseSensitive="false">65</SimpleAttributeExpression>
</ExpressionSet>
</SearchCriteria>
</QueryString>
</SearchJobConfig>
The expected output would be the Dates:
2019-06-01T04:00:00
2019-06-13T03:59:59
and what would it take to get the results on the same line.. example:
date_val_start date_val_end 2019-06-01T04:00:00 2019-06-13T03:59:59
I'm using SQL Server 2012 Enterprise Edition.
