numeric column names in mysql?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • veg_all@yahoo.com

    numeric column names in mysql?

    i am trying to create a table with a column name called 2004. But I
    keep getting a mysql error? Is there any workaround?

    Unable to execute: 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 '2004 TEXT,2004_refer ence TEXT,2005
    TEXT,2005_refer ence TEXT,200

    CREATE TABLE test (id int(6) NOT NULL auto_increment, membership_numb er
    TEXT,first_name TEXT,last_name TEXT,spouse TEXT,phone_priv
    TEXT,phone_bus TEXT,address_st reet TEXT,addr_town TEXT,addr_city
    TEXT,membership TEXT,donor TEXT,1998sa TEXT,1999sa TEXT,2000sa
    TEXT,200s1 TEXT,2002sa TEXT,2003sa TEXT,2003_refer ence TEXT,2004
    TEXT,2004_refer ence TEXT,2005 TEXT,2005_refer ence TEXT,2006
    TEXT,2006_refer ence TEXT, PRIMARY KEY (id),UNIQUE id (id))

  • Tom Thackrey

    #2
    Re: numeric column names in mysql?


    On 12-Mar-2006, veg_all@yahoo.c om wrote:
    [color=blue]
    > i am trying to create a table with a column name called 2004. But I
    > keep getting a mysql error? Is there any workaround?[/color]

    enclose the column name in back ticks e.g. `2004`

    --
    Tom Thackrey

    tom (at) creative (dash) light (dot) com
    do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)

    Comment

    Working...