我在Sybase IQ中有一個包含一些列的表A。其中一列被命名爲「評論」。在Sybase IQ中選擇「註釋」列時出現語法錯誤
每當我選擇欄:
select Comment from A
我得到了錯誤:
[Error Code: 102, SQL State: 42W04] SQL Anywhere Error -131: Syntax error near 'Comment'
我能夠選擇其他列沒有問題。你能否提出原因和解決方案?謝謝
我在Sybase IQ中有一個包含一些列的表A。其中一列被命名爲「評論」。在Sybase IQ中選擇「註釋」列時出現語法錯誤
每當我選擇欄:
select Comment from A
我得到了錯誤:
[Error Code: 102, SQL State: 42W04] SQL Anywhere Error -131: Syntax error near 'Comment'
我能夠選擇其他列沒有問題。你能否提出原因和解決方案?謝謝
嘗試
select "Comment" from A
COMMENT is a reserved word在Sybase IQ中。
這裏是the link explaining your problem。
Some keywords in SQL are also reserved words. To use a reserved word in a SQL statement as an identifier, you must enclose the word in double quotes. Many, but not all, of the keywords that appear in SQL statements are reserved words. For example, you must use the following syntax to retrieve the contents of a table named SELECT.
SELECT * FROM "SELECT"
謝謝,這很有效! – hydradon
要是你遇到其中一個名字似乎是從其他人,否則看起來相同的區別對待的情況下,你的第一反應應該總是以搜索[保留字在任何一種語言,你使用(HTTP ://infocenter.sybase.com/help/index.jsp?topic =/com.sybase.infocenter.dc38151.1510/html/iqrefbb/Alhakeywords.htm) –