If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Data truncation?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-07-10, 20:07
kristofer kristofer is offline
Registered User
 
Join Date: Sep 2008
Posts: 32
Data truncation?

Hi, why do I get this message:

Quote:
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
Reply With Quote
  #2 (permalink)  
Old 02-07-10, 20:27
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
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 my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 02-09-10, 06:45
kristofer kristofer is offline
Registered User
 
Join Date: Sep 2008
Posts: 32
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On