I have a feature class and related info in another table, the table having fields as Year, Year having values like - 2016,2017,2018,2019... Presently I Put the definition query for table Year = 2018 after that I have joined table to feature and published map service and the results perfectly fine. for next year also I need to change year=2019. So that without changing the code every time, I required based on the system date need to change the year. Please provide the code for that how to get the date in select by attribute

Year field is Integer

The Table is SQL Table which is not registered as versioned

  • What is field type? - date or integer – Mr. Che Dec 19 '18 at 10:58

I got the answer is the SQL table so I required to use as Year = Year(getdate())

Whereas in GIS Table use Yearfieldname = EXTRACT(YEAR FROM CURRENT_DATE)


You may try to use CURRENT_DATE to return current date then (perhaps) you have to transform it to integer because looks like it is not date type (2016,2017,2018,2019).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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