Subject Re: error formating date in stored procedure
Author Adam
--- In firebird-support@yahoogroups.com, "Anderson Farias"
<peixedragao@...> wrote:
>
> Hi,
>
> asuming you'll always have these 'string dates' as 'dd/mm/yyyy' you
can use:
>
> cast(
> substring(str_date_field from 1 for 2)||'.'||
> substring(str_date_field from 4 for 2)||'.'||
> substring(str_date_field from 7 for 4)
> as date)
>
>
> ('dd.mm.yyyy' is also a valid format for date 'input' on FB)
>
> of course, if you could do this 'conversion' inside Delphi it'd be
easier =)

Absolutely. In fact if you are doing it in Delphi, it seems a bit
backwards in converting the floating point representation to a string
representation then expecting Firebird to reverse that back into a
floating point or numeric (not sure which it uses) representation.

Something like this:

qry.SQL.Text := 'INSERT INTO mytable (...) VALUES (..., :dt_date);'
qry.ParamByName('dt_date').AsDate := DateTimePicker1.Date;
qry.ExecSQL;

(exact methods are dependent on connection suite).

Adam