Skip to main content
Solved

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

  • November 3, 2017
  • 3 replies
  • 262 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":

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
  • November 6, 2017

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


takashi
Celebrity
  • November 6, 2017

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
  • November 6, 2017

Where clause worked with this query

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

Thank you for your help!