Welcome to WebmasterWorld Guest from 54.145.136.73

Forum Moderators: open

MySql error adding new row

   
1:57 pm on Aug 12, 2008 (gmt 0)

10+ Year Member



Not used mySql for a long time and having a problem adding to a simple table.

Trying to add the row 'Postage' - it should be able to hold values with decimals - 1.99 for example.

SQL query:

ALTER TABLE `main` ADD `postage` SMALLINT( 1.99 ) NULL

MySQL said:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1.99) NULL' at line 1

Any help would be great, thanks!

2:16 pm on Aug 12, 2008 (gmt 0)

10+ Year Member



"SMALLINT" is an integer type, you probably need something like NUMERIC or DECIMAL (I forget which one MySQL uses, maybe both).
5:21 pm on Aug 12, 2008 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



It supports both NUMERIC and DECIMAL (one is implemented as other). You can check out the online docs at [dev.mysql.com...] or search for "mysql numeric data types" and look for the dev mysql site.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month