Subject Re: [firebird-support] I can't Backup/Restore a FB 2.01 database after creating it using a nScript
Author jft
Marc,
To duplicate the FLOOR functionality, as CAST does an automatic
rounding from floating point to integer, deduct 0.5 first.

Try this in iSQL:

select cast(6.999 - 0.5 as integer) from rdb$database /* gives 6 */;
select cast(7.0 - 0.5 as integer) from rdb$database /* gives 7 */;
select cast(7 - 0.5 as integer) from rdb$database /* gives 7 */;
select cast(7.999 - 0.5 as integer) from rdb$database /* gives 7 */;
select cast(8.0 - 0.5 as integer) from rdb$database /* gives 8 */;

HTH,
John

> -------Original Message-------
> From: marc_guillot <marc_guillot@...>
> Subject: [firebird-support] I can't Backup/Restore a FB 2.01 database after creating it using a nScript
> Sent: 15 Mar '07 05:30
>
> Hello.
>
> I creates a FB 2.01 using an Script (so I'am sure it's not corrupted),
> but it fails in backup/restore.
>
> gbak finishes Backup with no problem, but when restoring I get an
> error of FLOOR (from ib_udf.dll) not registered.
>
> ¿ In FB 2.01 there is not possible to backup/restore a database that
> uses udf's into their computed fields ?.
>
> I uses FLOOR udf, in a computed field who calculates the age of a
> person (from his birthday), if somebody knows anyway to calculate it
> without using udf's, i could avoid the problem.
>
> COMPUTED BY (cast(floor((current_date-cast(CLI_BIRTHDAY as
> date))/365.25) as integer))
>
> Thank you.
>
>