I created a query/event to do a yield calculation. The query is configured to look back in time a specified number of days using the dbo.Order_Master.TRNDTE_10 field. In the filter tab of the query, I have this filter:
DATEDIFF("dd", dbo.Order_Master.TRNDTE_10, GETDATE()) is less than or equal to ? Number
So, in the Event, you enter the number (compare value).
When I do a preview in the query, it works fine. When I try to test it from the event, I get and ODBC error complaining about datediff:
(1023) 37000: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid parameter 1 specified for datediff.
I don't see anything wrong with my syntax and I don't understand why it works from when I preview but not when I run from the event? Also, if I run this same query SQL Server Manager it works.
Thanks