Modifier le type d'un champ d'une table
Bonjour à tous ,je voudrai changer le type d'un champ d'une table (qui etait un integer pour le rendre un float) ,sur interbase c'est parfait ,mais le probleme est que coté delphi il travail toujour avec un integer , je l'ai supprimer puis rajouter (j'ai pencer rafraichir) mais rien :aie: , quelqun à deja eu ce pb ,SOS
pb de type de champ (integer et numeric) résolu
rebonjour,
j'ai enfin trouver la réponce:aie: ,enfaite c'est sur interbase que ça se passe ;je m'explique :
j'avais un champs integer que je voulais convertir en numeric ,coté interbase c'etai bon sauf qu'il a une maniere bien precise de coder les champs que voici :
NUMERIC --> INTEGER
NUMERIC(4) --> SMALLINT
NUMERIC(9) --> INTEGER
NUMERIC(10) --> DOUBLE PRECISION
NUMERIC(4,2) --> SMALLINT
NUMERIC(9,3) --> INTEGER
NUMERIC(10,4) --> DOUBLE PRECISION
DECIMAL --> INTEGER
DECIMAL(4) --> INTEGER
DECIMAL(9) --> INTEGER
DECIMAL(10) --> DOUBLE PRECISION
DECIMAL(4,2) --> INTEGER
DECIMAL(9,3) --> INTEGER
DECIMAL(10,4) --> DOUBLE PRECISION
//---------------------------------------
et voici ce que dit la doc officiel :
//--------------------------------------------------
IMPORTANT For a NUMERIC datatype, if a precision of less than 5 is specified without scale, InterBase
stores the datatype as a SMALLINT. If the precision is less than 10, InterBase stores the
type as an INTEGER. For precisions of 10 or greater, the datatype is stored as DOUBLE
PRECISION. See the previous table for the exact specifications.
Therefore, when you declare NUMERIC and DECIMAL datatypes with a precision of 10 or
greater, fractional numbers can be stored without specifying a scale.
For example, in isql, if you specify “NUMERIC(10)”, and insert a 13-digit number
“2555555.256789,” the number is stored exactly as specified, with 13 digits of precision
and six digits to the right of the decimal. Conversely, if you format the column as
NUMERIC(9), and insert the same 13-digit number “2555555.256789,” InterBase truncates
the fraction and stores the number as an INTEGER, “2555555.”
Similarly, for a DECIMAL datatype, if a precision of less than 10 is specified without scale,
InterBase stores the datatype as INTEGER; otherwise, it stores the datatype as DOUBLE
PRECISION.
IMPORTANT When you format the column as NUMERIC or DECIMAL with a precision of 10 or greater
without scale, you lose the ability to control both scale and precision.
Using the same NUMERIC(10) example, when you insert the 13-digit number
“2555555.256789,” the number is stored exactly as specified, with 13 digits of precision
and 6 digits to the right of the decimal. If you insert an 11-digit number “255555.25678,”
the number is also stored exactly as specified with 11 digits of precision, and 5 fractional
digits. You might expect that the precision would always be 10 because you explicitly
specified 10, but it also varies depending upon precision of the inserted data.
TIP If you want to store fixed-decimal numbers such as monetary values, do not declare
NUMERIC or DECIMAL with a precision of 10 or greater without specifying scale. In
addition, if you need to control the precision for decimal data, you must specify scale.
//--------------------------------------------------
donc si vous maiter numeric(9,2) delphi le reconnetra autant que integer et non que double !!!!
j'espere aider quelque uns avec ça ,bonne programmation