0

I am stumped as to how to get this to work in ArcMap...

I have records being created ever day, and would like to be able to show records on a map that have been created within the last 2 days based on a date field in our SDE feature class. How can I write a definition query in SQL to do this so that it automatically changes to the current date and then grabs records from the past 2 days? I've looked on the web, but have had no luck finding anything that matches what I need.

The values in our SQL 2012 database for the created_date field are formatted as such:

2014-11-04 18:44:09.0000000
2
  • Have you researched date functions in SQL Server? This is nearly trivial with a supported datetime, but ungainly slow with string types.
    – Vince
    Sep 13, 2017 at 13:13
  • is this a AGOL Webmap? since the data being displayed is dyanmic you should apply the query at the map level and filter record created within 30 d of current datetime. You can use current date time filters in operations dashboard...
    – NULL.Dude
    Sep 13, 2017 at 13:29

1 Answer 1

1

I Found this to work, based on How to select data from 30 days? I just had to tweak what they provided from a 30 day select to a 1 day select

created_date >= DATEADD(DAY, -1, getdate())

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.