View Single Post

   
  #3 (permalink)  
Old 02-28-2008, 11:29 AM
Good Man
 
Posts: n/a
Default Re: CREATE TABLE with 'table' and 'field' as Key names

Good Man <heyho@letsgo.com> wrote in
news:Xns99DC933AB6A4Bsonicyouth@216.196.97.131:

> Darek <darek@nowhere.nohow> wrote in
> news:fgflrf0205o@news1.newsguy.com:
>
>
>> This database is for a hosted site, so I don't know if the key names
>> are required, and I'm not really in a position to start renaming
>> them.
>>
>> The same error pops up when I try the insert on 3.23.49 and I got
>> this CREATE syntax from mysqldump, using '-c -a', '-c', '-a' and no
>> switch at all.
>>
>> What can I do to troubleshoot this further?

>
> Well, no point in troubleshooting it further because you know the
> problem: MySQL has "Reserved Words" that your database is using.
> You'll have to change your database.
>
> http://dev.mysql.com/doc/refman/5.0/...ved-words.html


Actually according to that doc it suggests that you may use reserved
words if they are quoted properly:

mysql> CREATE TABLE interval (begin INT, end INT);
ERROR 1064 (42000): You have an error in your SQL syntax ...
near 'interval (begin INT, end INT)'

mysql> CREATE TABLE `interval` (begin INT, end INT);
Query OK, 0 rows affected (0.01 sec)


http://dev.mysql.com/doc/refman/5.0/en/identifiers.html

Reply With Quote