I am trying to build a query in SQL Server 2019 to return data for events that are greater than 2 days, but there is no specific datetime field. The only field with datetime data within it also has other information.
I used SUBSTRING
to pull only the date time info from the field, but the query is still not working.
Here is what the last_success_date field looks like after using SUBSTRING: 2022-08-07T23:03:36-07:00 I've tried also limiting it to only the year/month/day return.
SELECT
resource_key
, SUBSTRING(last_actions,3,13) as 'Action'
, SUBSTRING(last_success,actions,27,25) as 'Last_Success_Date'
, applied_policy_names
from resources_status
where 'Last_Success_Date' >= DATEADD(DAY, -2,GETDATE())*
With this I am getting:
Conversion failed when converting date and/or time from character string.
Any ideas?