Jump to content

[SOLVED] Field name a number


mrMarcus

Recommended Posts

Hello all,

 

i was just wondering if you are able to use a number (ie. 1) as a field name in a database (MySQL) .. 'cause i tried it and was unable to update the database, but when changing the same field to an alpha-numeric value, the update was successful.

 

if having a numeric value is possible, what do i have to do way of query or setup to allow for that?

 

thanks in advance.

Link to comment
Share on other sites

The mysql manual (in the Schema Object Names section) tells you how to do this, but a column, like a variable or anything else in programming, should have a name that indicates the use or purpose. Wanting to do this leads us to believe your table is not designed correctly and you will have both problems writing code because the column names won't help and your design is probably not normalized, which will make the code more complicated and run slower than necessary.

Link to comment
Share on other sites

i was easily able to change it .. i was just messing around with a calendar script i started writing, and just set up the database initially to be queried directly relating to the numeric value of each month.  Selecting from the db was not a problem when having numeric values for the fields, it was just when updating/inserting into the db that problem arose.

 

wasn't that big a deal, and i never would've set the db up that way had i known it wouldn't work.  so i just simply renamed the fields to their respective months and it works like a beaut.

 

thanks for the replies.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.