Skip to main content
Solved

Bringing in Data for past 30 days from SQl server using SQL to run before read

  • Nov 3, 2017 8:23 PM UTC
  • 3 replies
  • 357 views

Forum|alt.badge.img

Hello I am new to FME and I am trying to bring in spatial data from SQL server by adding where clause in the reader using function "SQL to Run before Read". I am not sure what query do I use?I am using the following statement but it is giving error.

select * from SDEDBO.Services where Date>=Dateadd('day', GETDATE(),-30)

thanks for your help!

Best answer by david_r

You should probably use the "WHERE clause" setting and not the "SQL to Run before Read":

View original
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

david_r
Celebrity
  • Best Answer
  • Nov 6, 2017 8:13 AM UTC

You should probably use the "WHERE clause" setting and not the "SQL to Run before Read":


takashi
Celebrity
  • Nov 6, 2017 1:19 PM UTC

Looks the syntax for the Dateadd function is wrong. Check here: DATEADD (Transact-SQL)

I think the WHERE clause should be:

Date >= Dateadd(dd, -30, GETDATE())

Forum|alt.badge.img
  • Author
  • Nov 6, 2017 3:08 PM UTC

Where clause worked with this query

Date >= Dateadd(dd, -30, GETDATE())

Thank you for your help!