How do i escape reserve names in a column? MySQL/Create Table

Posted by acidzombie24 on Stack Overflow See other posts from Stack Overflow or by acidzombie24
Published on 2010-05-22T21:43:59Z Indexed on 2010/05/22 21:50 UTC
Read the original article Hit count: 138

Filed under:
|

I am generating tables from classes in .NET and one problem is a class may have a field name key which is a reserved mysql keyword. How do i escape it in a create table statement? (Note: The other problem below is text must be a fixed size to be indexed/unique)

create table if not exists misc_info (
id INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL,
key TEXT UNIQUE NOT NULL,
value TEXT NOT NULL)ENGINE=INNODB;

© Stack Overflow or respective owner

Related posts about mysql

Related posts about escape