Welcome to WebmasterWorld Guest from 54.196.232.162

Forum Moderators: open

Message Too Old, No Replies

MySql error adding new row

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

Junior Member

10+ Year Member

joined:Apr 21, 2004
posts: 48
votes: 0


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)

Preferred Member

10+ Year Member

joined:Oct 1, 2004
posts:607
votes: 0


"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)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Nov 11, 2007
posts:769
votes: 1


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.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members