mysql double-quoted table names

后端 未结 1 1676
孤城傲影
孤城傲影 2020-12-17 00:33

I\'m doing a mysql query like:

Select * from \"User\";

and it returns:

You have an error in your SQL syntax; check t

相关标签:
1条回答
  • 2020-12-17 01:15

    Taken from this post:

    SET GLOBAL SQL_MODE=ANSI_QUOTES;
    

    Personally when I tested, I had to do it like this:

    SET SQL_MODE=ANSI_QUOTES;
    

    I don't think there's any other way.

    http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_ansi_quotes

    ANSI_QUOTES

    Treat “"” as an identifier quote character (like the “`” quote character) and not as a string quote character. You can still use “`” to quote identifiers with this mode enabled. With ANSI_QUOTES enabled, you cannot use double quotation marks to quote literal strings, because it is interpreted as an identifier.

    0 讨论(0)
提交回复
热议问题