Why is this SQL expression invalid?

297
2
12-16-2021 03:39 PM
ChrisCowin
New Contributor III

I'm upgrading a model that processes GPS Points. From the GPS device we can only get a table with every point, so I'm trying to create additional function that will go to the ultimate GDB and get the last date in the field "Start_Time" which is a date field. I achieve this by sorting by descending of this field and then "Get Field Value" from utilities into a date variable. Where I'm stuck is making the SQL expression using inline replacement to delete all the values that are lower than the variable I got from the server. However everything I've tried returns an error saying the expression is invalid.

Expressions I've tried based off this article:

Start_Time >= date %Last_Start_Date%
"Start_Time" >= date %Last_Start_Date%
Start_Time >= %Last_Start_Date%
"Start_Time" >= %Last_Start_Date%
Start_Time >= /'%Last_Start_Date%/'

 The value that the variable reports is:

2/12/2021 5:00:41 AM

 

I don't really know what else to try. Its really hard to understand why it doesn't work when the error just says it doesn't work.

0 Kudos
2 Replies
jcarlson
MVP Esteemed Contributor

What DB system are you on? That article references a few other formats for things like Oracle, Postgres, etc.

- Josh Carlson
Kendall County GIS
0 Kudos
ChrisCowin
New Contributor III

Just a regular old GDB, nothing fancy. I tried changing the variable to a string and then used:

Start_Time <= date '%Last_Start_Date%'

That seems to have worked, but think its a little odd I can't do that directly since its already in a date field.

0 Kudos