Results 1 to 4 of 4

Thread: columnnames

  1. #1
    Join Date
    Jun 2007
    Posts
    19

    Unanswered: columnnames

    Hi,

    I just have some trouble with column names in MySQL database.

    For instance, I can't create a column named "Right"!

    Another example: If the column contains a '.' (full stop) or a '/' (slash) I get an error message.

    Is there a list of reserved strings or chars I'm not allowed to use as column names?

    Chris

  2. #2
    Join Date
    May 2007
    Posts
    8
    Hi Chris,

    'Right' is reserved word in Mysql that's why you are not allowed to create column with that name.

    Check below link for list of Mysql reserved words:
    http://www.brainbell.com/tutorials/M...rved_Words.htm

    Thanks,

  3. #3
    Join Date
    Jun 2007
    Posts
    19
    Thanks a lot!

    That's exactly what I'm looking for.

    btw: For instance, if a columnname contains a full stop or a slash you have set the name in backticks ``! Then it works

    Chris

  4. #4
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by Chriz81
    btw: For instance, if a columnname contains a full stop or a slash you have set the name in backticks ``! Then it works
    My recommendation: don't do it!
    Choose a different name instead, you will save yourself a lot of trouble!

    Additionally the SQL with the backtick is not portable. You will have a hard time if you need to run that on a DBMS that uses ANSI quoting. The standard for quoting names with special characters is the double quote, e.g "some.column"

Posting Permissions

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