Go Back   Forum Care Forums > Development Reference Area > MySQL Discussion

Reply
 
LinkBack Thread Tools Display Modes
MySQL Data Truncation error???
Old
  (#1)
Guest
Guest
 
Posts: n/a
Default MySQL Data Truncation error??? - 06-04-2007, 07:45 AM

> 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

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: MySQL Data Truncation error???
Old
  (#2)
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: MySQL Data Truncation error??? - 06-04-2007, 07:45 AM

EMAIL REMOVED 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...
>
> 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.
EMAIL REMOVED
==================
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: MySQL Data Truncation error???
Old
  (#3)
Peter H. Coffin
Guest
 
Posts: n/a
Default Re: MySQL Data Truncation error??? - 06-04-2007, 07:45 AM

On 9 Jan 2007 10:37:07 -0800, EMAIL REMOVED 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.

--
"Doesn't everybody?" is a question that never expects an answer of "No."
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: MySQL Data Truncation error???
Old
  (#4)
Paul Lautman
Guest
 
Posts: n/a
Default Re: MySQL Data Truncation error??? - 06-04-2007, 07:46 AM

Peter H. Coffin wrote:
> On 9 Jan 2007 10:37:07 -0800, EMAIL REMOVED 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 ;-)


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: MySQL Data Truncation error???
Old
  (#5)
Peter H. Coffin
Guest
 
Posts: n/a
Default Re: MySQL Data Truncation error??? - 06-04-2007, 07:46 AM

On Tue, 9 Jan 2007 20:05:15 -0000, Paul Lautman wrote:
> Peter H. Coffin wrote:
>> On 9 Jan 2007 10:37:07 -0800, EMAIL REMOVED wrote:
>>> 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 ;-)


If I can shatter some illusions *and* ruin someone's day with only one
sentence, I consider that a job well done.

--
When all you have is a hammer, every problem looks like a messiah.
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: MySQL Data Truncation error???
Old
  (#6)
Guest
Guest
 
Posts: n/a
Default Re: MySQL Data Truncation error??? - 06-04-2007, 07:46 AM

> 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

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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

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





Contact Us - Forum Care Forums - Archive - Top