I am using a FeatureReader to connect to our SDE GDB. I want to add a query (WHERE Clause) to the FeatureReader so that I am only pulling in records within the Feature Class that were edited within the last month (or sometimes edited in the last 5 days).
When I look at the SDE data via MS SQL Server Management Studio (SSMS) vs within FME's Data Inspector I see the data in different formats:
Within SSMS - LAST_UPDATED field is a DATE field:
last_updated (datetime2(7), null)
2018-12-01 16:23:56.0000000
Within Data Inspector - LAST_UPDATED field is STRING field:
last_updated (string)
20181128133118
My questions:
1) is there a way to specify which attributes I want to be brought in? Right now I am using an attribute manager to remove the unwanted attributes.
2) How do I only at a WHERE Clause so that I only pull in the data I want within the specific time range? I have tried "last_updated" > '20180500000000' but this brings in nothing. I am assuming this is because FME is treating the field as a string? If this is true, then...
3) How do I get FME to see this field as a date field while using the FeatureReader?
4) Once I am able to work with this data as a date, how do I do a WHERE Clause so that I only pull data that has been edited within the last 5 days? I will be running this query everyday, so I want the query to be something like last_updated >= dateadd(DAY,-5, GETDATE())
I am using FME(R) 2018.1.0.2 (20180903 - Build 18547 - WIN64)
Also tried a WHERE Clause of @DateTimeCast("last_updated",datetime) > '20181201000000' but get the following error:
The error number from ArcObjects is: '-2147216072'. The error message from ArcObjects is: {Underlying DBMS error [[Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near '>'