solution to reserved keywords as column name--save DP member you guys' time

Discussion in 'MySQL' started by justinlorder, Aug 28, 2008.

  1. #1
    My content is as title.
    Recently, I has waste lot of time to solve a problem.

    I want to do some mysql update command. But it fail to execute.
    At last I find out the reason. The column I want to update has the same name as the reseved keywords of mysql.
    The column name is desc . I know it is better not to use such keywords as column names. But the database structure is already there by cms designer.

    I have waste lot of time seeking solutions.
    At lst I found the solution on their offical site.
    I post it here ,maybe some DP member encounter the same problems like me.

    My mysql command is as following


    update gallery
    set `desc` = 'interesting dolls'
    where imageid = '20';

    Notice:
    you just use `` to quote the column name(keywords).
    Remember ` is on the left head of the keybroad, under Esc key and before 1(!) Key. It is not comma.
    It is the same when use in select, insert and other command.
     
    justinlorder, Aug 28, 2008 IP