Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Firebird e Interbase (https://www.clubdelphi.com/foros/forumdisplay.php?f=19)
-   -   Problema en Campos Computed By (https://www.clubdelphi.com/foros/showthread.php?t=23738)

Carlos Hurtado 27-07-2005 06:03:07

Problema en Campos Computed By
 
Hola Amigos, estoy trabajando con Firebird 1.5 con Delphi 7 y es para mi muy interesante usar campos Computed By.
Pero aqui viene el problema. Por Ej:

Create Table Prueba(
Valor Integer,
PorImpuesto Decimal(4,2);
Impuesto Computed BY(Valor * PorImpuesto / 100));

Valor := 515
PorImpuesto := 6.22
Impuesto := 32.03

Como se puede ver esto funciona perfectamente, pero como hago para que el resultado, o sea el campo impuesto tenga un valor Integer redodendeado al entero mas proximo en este caso 32.

Muy agradecido si me ayudan a resolverlo.

Rufus 27-07-2005 09:42:16

Prueba con:
Código SQL [-]
Create Table Prueba(
Valor Integer,
PorImpuesto Decimal(4,2),
Impuesto Computed By(cast((Valor * PorImpuesto / 100) as integer)));


La franja horaria es GMT +2. Ahora son las 23:16:56.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi