Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2008
    Posts
    33

    Unanswered: Data truncation?

    Hi, why do I get this message:

    Error code 0, SQL state 22001: Data truncation: Out of range value for column 'experience' at row 1
    Line 1, column 1
    ...when I do:

    Code:
    INSERT INTO competenceprofiles (id, name, experience, person_id, competence_id) 
                            VALUES (1, 'Administration', 3.5, 2, 1);
    ...on this table:

    Code:
    CREATE TABLE competenceprofiles (
    	id INTEGER PRIMARY KEY,
    	name VARCHAR(255),
    	experience NUMERIC(2,2),
    	person_id INTEGER REFERENCES people,
    	competence_id INTEGER REFERENCES competences
    );
    I'm using MySQL 5.1.11.

    I'd appreciate any help.

    /Kris

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so what values are you getting in your table, did that give you any clue as to what the problem is?
    my guess would be the declaration of experience is the issue
    as ever da manuel is a font of knowledge. form that I would suggest you want numeric(4,2), or possibly numeric (5,2)
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Sep 2008
    Posts
    33
    Thanks! I was told that the script had been tested against a PostgreSQL-database and was working so I figured I must have misunderstood the way NUMERIC(M,N) works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •