www.webdeveloper.com
Results 1 to 6 of 6

Thread: simple decimal problem

  1. #1
    Join Date
    Aug 2005
    Location
    mars
    Posts
    223

    Smile simple decimal problem

    I have this code to create the database:
    Code:
    drop database expenses2006;
    create database expenses2006;
    use expenses2006;
    create table January (                 <-- line 5
    	id int not null auto_increment,
    	Date varchar(5),
    	Description varchar(50),
    	Office Exp. decimal(),
    	Dues/Public decimal(),
    	Business Lunch decimal(),
    	Conf./Cont. ED. decimal(),
    	Supplies for Prod. decimal(),
    	Small Equip. decimal(),
    	Prom./Adv. decimal(),
    	Travel decimal(),
    	Freight decimal(),
    	Photo decimal(),
    	Post decimal(),
    	primary key(id)
    );
    I have it make an identical table for every month of the year. It gives me messages saying something is wrong with the 'decimal' in line five. I have tried decimal, decimal(3,2), and as you can see decimal().
    Last edited by crazycoder; 03-11-2006 at 06:25 PM.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,145
    I've never worked with a database system that allowed column names with slashes, space, or periods. Could that be the problem?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Aug 2005
    Location
    mars
    Posts
    223
    I thought that might be the problem, but the errors from the console point elsewhere. I'll try it though.

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,145
    Error messages are notorious for being misleading.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    you have the following errors in your create table:

    error: column names can't contain spaces
    warning: invalid character ("/")
    warning: invalid character (".")
    error: invalid column type decimal().

    decimal needs at least 1 argument, it seems.
    http://dev.mysql.com/doc/refman/5.0/...ric-types.html
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time

  6. #6
    Join Date
    Aug 2005
    Location
    mars
    Posts
    223
    Thanks! I just replaced all the ' ' with underscores.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles