IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Bases de données Delphi Discussion :

Modifier le type d'un champ d'une table


Sujet :

Bases de données Delphi

  1. #1
    atb
    atb est déconnecté
    Membre éprouvé

    Homme Profil pro
    Inscrit en
    Novembre 2004
    Messages
    639
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Autre

    Informations forums :
    Inscription : Novembre 2004
    Messages : 639
    Points : 929
    Points
    929
    Par défaut 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 , quelqun à deja eu ce pb ,SOS

  2. #2
    atb
    atb est déconnecté
    Membre éprouvé

    Homme Profil pro
    Inscrit en
    Novembre 2004
    Messages
    639
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Autre

    Informations forums :
    Inscription : Novembre 2004
    Messages : 639
    Points : 929
    Points
    929
    Par défaut pb de type de champ (integer et numeric) résolu
    rebonjour,
    j'ai enfin trouver la réponce ,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

Discussions similaires

  1. [AC-2013] Modifier le type d'un champ dans une base distante
    Par MissTi dans le forum VBA Access
    Réponses: 1
    Dernier message: 26/09/2014, 16h11
  2. Modifier le type d'un champ d'une table Interbase
    Par Mariness dans le forum InterBase
    Réponses: 2
    Dernier message: 18/10/2011, 10h19
  3. Modifier le type d'un champ d'une table liée à un fichier CSV
    Par Borowsky dans le forum Modélisation
    Réponses: 3
    Dernier message: 26/03/2009, 12h14
  4. Connaître le type d'un champs d'une table Mysql
    Par xoran dans le forum Langage SQL
    Réponses: 1
    Dernier message: 20/07/2005, 09h29
  5. changement de type pour un champ dans une table
    Par Missvan dans le forum PostgreSQL
    Réponses: 2
    Dernier message: 23/02/2004, 15h26

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo