dbTalk Databases Forums  

MySQL Data Truncation error???

comp.databases.mysql comp.databases.mysql


Discuss MySQL Data Truncation error??? in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
nino9stars@yahoo.com
 
Posts: n/a

Default MySQL Data Truncation error??? - 01-09-2007 , 12:37 PM






Quote:
Well, you defined the field to take a maximum of 99.99.
What do you expect MySQL to do?

If you want to put 140 in there, you need to leave room
for three digits to the left of the decimal point.
Maybe I am misunderstanding, but isn't that what I did by defining my
data type as: double(4,2)??? Doesn't that mean 4 numbers to the left of
the decimal place, and 2 numbers to the right???

Don't tell me it means 4 total digits with 2 decimal spots...

Nino



Reply With Quote
  #2  
Old   
Jerry Stuckle
 
Posts: n/a

Default Re: MySQL Data Truncation error??? - 01-09-2007 , 12:58 PM






nino9stars (AT) yahoo (DOT) com wrote:
Quote:
Well, you defined the field to take a maximum of 99.99.
What do you expect MySQL to do?


If you want to put 140 in there, you need to leave room
for three digits to the left of the decimal point.


Maybe I am misunderstanding, but isn't that what I did by defining my
data type as: double(4,2)??? Doesn't that mean 4 numbers to the left of
the decimal place, and 2 numbers to the right???

Don't tell me it means 4 total digits with 2 decimal spots...

Nino

Yes, when specifying the size, the first number is the total size
(digits) and the second is the precision (number of digits to the right
of the decimal point).

See http://dev.mysql.com/doc/refman/5.1/...ric-types.html


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================


Reply With Quote
  #3  
Old   
Paul Lautman
 
Posts: n/a

Default Re: MySQL Data Truncation error??? - 01-09-2007 , 02:05 PM



Peter H. Coffin wrote:
Quote:
On 9 Jan 2007 10:37:07 -0800, nino9stars (AT) yahoo (DOT) com wrote:
Well, you defined the field to take a maximum of 99.99.
What do you expect MySQL to do?

If you want to put 140 in there, you need to leave room
for three digits to the left of the decimal point.

Maybe I am misunderstanding, but isn't that what I did by defining my
data type as: double(4,2)??? Doesn't that mean 4 numbers to the left
of the decimal place, and 2 numbers to the right???

Don't tell me it means 4 total digits with 2 decimal spots...

That's exactly what it means, though.
You went and told him and he specifically asked you not to! I mean he had
gone to all the trouble of not reading it in the manual and then asked not
to be told and you still went and did it. Some friend you are ;-)




Reply With Quote
  #4  
Old   
nino9stars@yahoo.com
 
Posts: n/a

Default Re: MySQL Data Truncation error??? - 01-10-2007 , 03:56 PM



Quote:
Yes, when specifying the size, the first number is the total size
(digits) and the second is the precision (number of digits to the right
of the decimal point).

See http://dev.mysql.com/doc/refman/5.1/...ric-types.html
Thanks Jerry! I've read over the manual before, and have been using
doubles in tables with no problems for years now. I never had problems
before, so it didn't dawn on me that I had a false notion of how a
double is defined. I really appreciate you pointing that out to me...
thanks.

Nino



Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.