homepage Welcome to WebmasterWorld Guest from 54.163.72.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
MySql error adding new row
hunkydory




msg:3721094
 1:57 pm on Aug 12, 2008 (gmt 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!

 

zCat




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

"SMALLINT" is an integer type, you probably need something like NUMERIC or DECIMAL (I forget which one MySQL uses, maybe both).

ZydoSEO




msg:3721292
 5:21 pm on Aug 12, 2008 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved