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

Rewind, the problem does not exist!

In my real database there is a series of fields delta1, delta2, delta3, etc., which were all integer and contained a number of months. However, there is one of them (delta9) which by error had been converted to VarChar, and it just happened that that was the field I was using for testing DateAdd. So, the attempt to negate a string obviously is rejected by SQL!

So, the error was mine.

Thank you for your help and please excuse me the erroneous post.

Mike Watson
Datos Informatica.


--- In firebird-support@yahoogroups.com, "Mike" <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?
>
> Mike Watson
> Datos Informatica.
>