numeric column names in mysql?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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_reference TEXT,2005
TEXT,2005_reference TEXT,200

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

Re: numeric column names in mysql?

On 12-Mar-2006, wrote:

Quoted text here. Click to load it

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

Tom Thackrey
tom (at) creative (dash) light (dot) com
do NOT send email to (it's reserved for spammers)

Site Timeline