Subject Re: [firebird-support] expressing time as a numeric vale in dialect 3
Author Martijn Tonies
Hello Peter,

> I have a trigger on an insert on a table and I'm trying to set a time
field in dialect 3 to
> a calculated value. (basically spaced at 1 min intervals from midnight to
7 am, then
> back to midnight as id wraps around by using modulus)
>
> If I use
>
> new.contact_time = '00:00:01' it works
>
> if I use
>
> new.contact_time = new.id * (1.000/1440)
>
> it compiles but fails when inserting records as I think it wants a string
?

No, it wants a time.

> I know time is stored as a 32 bit integer and I want to set it at this
level with an
> integer modulus calculation.
> Any ideas how I can set this field by calculation ?

You're not calculating a time, the result of your calculation is a floating
point value.

Cast it to TIME.

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com