Aditya Vikas Devarapalli
Aditya Vikas Devarapalli

Reputation: 3473

Table name show a syntax error in MySQL

When I try to create a table with the following name in MySQL it show a syntax error but its not showing any problem if I use the phpmyadmin :

"attn-cse-a[3-1][mpms][10-8-2013]"

when I create a same type of table with a different name I am able to do it without any problems..

Any help would be greatly appreciated ..

Upvotes: 0

Views: 1269

Answers (2)

ralatorre
ralatorre

Reputation: 22

You may use illegal characters by escaping them with backticks, but I won't recommend it, since it will only bring you trouble for the rest of the project's lifetime.

Upvotes: 0

Ivan Buttinoni
Ivan Buttinoni

Reputation: 4145

Use back quotes to wrap tablename:

create table `attn-cse-a[3-1][mpms][10-8-2013]` (...

Upvotes: 3

Related Questions