Author Topic: random question google didnt help  (Read 367 times)

0 Members and 1 Guest are viewing this topic.

Offline RiftsTopic starter

  • Devotee
  • Posts: 612
  • Gender: Male
    • View Profile
random question google didnt help
« on: March 15, 2010, 02:55:59 PM »
really simple can I use a number such as 001 as a column name becuase if so i can not figure out the syntax for it
im trying

alter table members add column 001 varchar (3)

and i tried

alter table members add column '001' varchar (3)

Offline MatthewJ

  • Devotee
  • Posts: 801
  • Gender: Male
    • View Profile
Re: random question google didnt help
« Reply #1 on: March 15, 2010, 03:01:38 PM »
From the mysql documentation

Quote
Identifiers may begin with a digit but unless quoted may not consist solely of digits

Hope that helps.

Offline wildteen88

  • Guru
  • 'Insane!'
  • *
  • Posts: 12,021
  • Gender: Male
    • View Profile
Re: random question google didnt help
« Reply #2 on: March 15, 2010, 03:09:09 PM »
Both of those are correct except 001 should be wrapped in backticks  eg `001`.

Offline fenway

  • MySQL Si-Fu / PHP Resident Alien
  • Global Moderator
  • 'Mind Boggling!'
  • *
  • Posts: 15,443
  • Gender: Male
    • View Profile
Re: random question google didnt help
« Reply #3 on: March 19, 2010, 08:44:20 AM »
Please don't.
:anim_rules: Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.