Re: Help with Simple SQL Insert

2007-09-10 Thread Jochem van Dieten
Aaron Roberson wrote:
 Query Error: Data truncation: Out of range value adjusted for column
 'ordernumber' at row 1
 
 Here is the SQL statement:
 INSERT INTO orders(ordernumber, tax, shipping, total)
 VALUES(558972266568040,0.0,4.75,24.7)
 
 In my database (MySQL 5) I have the following fields in my orders table:
 id (int 11)
 ordernumber (int 75)

Your datatype is INT, your display mask is 75. You can not store 
558972266568040 in an INT field. Use a BIGINT if that is sufficient for 
current and future needs or a DECIMAL field.

Jochem

~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:288079
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Help with Simple SQL Insert

2007-08-30 Thread Aaron Roberson
This just keeps blowing me away. A simple, simple SQL insert statement keeps
throwing an error and I can't figure out why.
Here is the error message:
Query Error: Data truncation: Out of range value adjusted for column
'ordernumber' at row 1

Here is the SQL statement:
INSERT INTO orders(ordernumber, tax, shipping, total)
VALUES(558972266568040,0.0,4.75,24.7)

In my database (MySQL 5) I have the following fields in my orders table:
id (int 11)
ordernumber (int 75)
tax (double)
shipping (double)
total (double)


Everything looks right to me, what in the world could I be missing? Why is
it saying that the value is being truncated for the ordernumber column when
the value is all numbers definitely is not larger than 75 digits?

Thanks for your help, hopefully someone can spot whatever it is that I'm
overlooking.

-Aaron


~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287468
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Help with Simple SQL Insert

2007-08-30 Thread Nick de Voil
Aaron

  Here is the error message:
  Query Error: Data truncation: Out of range value adjusted for column
  'ordernumber' at row 1
 
  Here is the SQL statement:
  INSERT INTO orders(ordernumber, tax, shipping, total)
  VALUES(558972266568040,0.0,4.75,24.7)
 
  In my database (MySQL 5) I have the following fields in my orders table:
  id (int 11)
  ordernumber (int 75)
  tax (double)
  shipping (double)
  total (double)

I'm surprise MySQL let you define a column as int 75. No normal 
computer can store an integer with 75 significant digits. You might have 
meant to use DECIMAL - but actually I think a character type would 
probably be more appropriate.

Nick


~|
Check out the new features and enhancements in the
latest product release - download the What's New PDF now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287471
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Help with Simple SQL Insert

2007-08-30 Thread Aaron Roberson
Yeah, I just kept bringing the range up on that column because even when I
had it at 11 or 25 I kept getting the same data truncated error.
I went ahead and changed it to varchar(75) to test it.

-Aaron

On 8/30/07, Nick de Voil [EMAIL PROTECTED] wrote:

 Aaron

  Here is the error message:
  Query Error: Data truncation: Out of range value adjusted for column
  'ordernumber' at row 1
 
  Here is the SQL statement:
  INSERT INTO orders(ordernumber, tax, shipping, total)
  VALUES(558972266568040,0.0,4.75,24.7)
 
  In my database (MySQL 5) I have the following fields in my orders table:
  id (int 11)
  ordernumber (int 75)
  tax (double)
  shipping (double)
  total (double)

 I'm surprise MySQL let you define a column as int 75. No normal
 computer can store an integer with 75 significant digits. You might have
 meant to use DECIMAL - but actually I think a character type would
 probably be more appropriate.

 Nick


 

~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287474
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Help with Simple SQL Insert

2007-08-30 Thread Robert Harrison
The problem almost certainly lies in the field definitions in the data base
tables. I suspect the double values, but I think you should take a look at
the int values as well. They look huge. I can't speak to mySQL exactly as I
use other DBs, but most DBs compact integer data into binary, so field sizes
are not number of characters. For example, in SQL Server (smallint 4) can
store any number from from -2^15 through 2^15 - 1 (2 to the power of...
binary).

Here's a link that may help with MYSQL data types:
http://www.htmlite.com/mysql003.php 

Robert B. Harrison
Director of Interactive services
Austin  Williams
125 Kennedy Drive, Suite 100 Hauppauge NY 11788
T : 631.231.6600 Ext. 119 
F : 631.434.7022
www.austin-williams.com

Great advertising can't be either/or... It must be .




~|
ColdFusion 8 - Build next generation apps
today, with easy PDF and Ajax features - download now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287476
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4