If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > columnnames

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-03-07, 15:54
Chriz81 Chriz81 is offline
Registered User
 
Join Date: Jun 2007
Posts: 19
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
Reply With Quote
  #2 (permalink)  
Old 07-04-07, 00:35
swapnilclarion swapnilclarion is offline
Registered User
 
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,
Reply With Quote
  #3 (permalink)  
Old 07-04-07, 03:49
Chriz81 Chriz81 is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 07-04-07, 05:57
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
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"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On