Subject Re: [firebird-support] How to calcuate the days between 2 DATE fields
Author Alexandre Benson Smith
william_yuwei wrote:

>Hi,
>
> How to calcuate the days between two DATE fields? I tried to using
>the following statement in one of my stored procedure, but it failed
>to compile it:
>
> Days = :INVOICE_DATE - 'TODAY'
>
>Thanks
>
>William
>
>
William,

the ":" don't need to be used in everyplace, I don't know the correct
syntax, but in select, insert, update, delete you should use ":" because
it could be confused with the table columns.

In simple assigments you don't need it.

I would use something like:
Days = Invoice_Date - Current_Date

if Invoice_Date is a variable declares in you procedure.

If InvoiceDate is a column in one of your tables, you should first
assign it to some local variable or use it inside SQL statements that
invonve that table.

just a tip:
Provide as much information as you can, you don't told us even de error
message you are getting.

see you !

--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br