Subject Re: Firebird SQL built-in function DATEADD with negative argument
Author Mike
Hello, Helen!

I've tried the syntax as you suggest:

DateAdd (MONTH, (-1 * Delta), DateLast)

but it still doesn't work. It gives the same "Dynamic SQL error expression evaluation not supported".

Any further suggestions?

Regards,

Mike Watson
Datos Informatica

--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...> wrote:
>
> At 12:40 AM 11/06/2010, Mike wrote:
> >When I use the DateAdd function in SQL it works OK with the following syntax:
> >
> > DateAdd (MONTH, Delta, DateLast)
> >
> >where Delta contains a number of months and DateLast contains a valid Date value.
> >
> >However, if I want to decrement the result I use the following syntax:
> >
> > DateAdd (MONTH, -Delta, DateLast)
> >
> >and I get "Dynamic SQL error expression evaluation not supported".
> >
> >I have tried -(Delta) ; -[Delta] ; [Delta]*-1 and so on but with no success.
> >
> >What is the correct syntax for subtracting using DateAdd? Or, is there a bug?
>
> The third example is closest, but expressions passed as function arguments need to be isolated in brackets. Have you tried
>
> DateAdd (MONTH, (-1 * Delta), DateLast)
>
> ./heLen
>