2017-07-26 5 views
1

Sybase IQにいくつかのカラムがあるテーブルAがあります。列の1つに「コメント」という名前が付けられます。Sybase IQでカラム 'コメント'を選択すると構文エラーが発生する

私はその列を選択するたびに:私は問題なく、他の列を選択することができる午前

[Error Code: 102, SQL State: 42W04] SQL Anywhere Error -131: Syntax error near 'Comment' 

select Comment from A 

を私はエラーを得ました。理由と解決方法を教えてください。

+3

あなたは1名は他の点では同じように見える他の人から異なる扱いしているように見えるような状況が発生した今までにした場合、あなたの最初の本能は常に[あなたが使っているものは何でも言語の予約語]を検索しなければなりません(HTTP ://infocenter.sybase.com/help/index.jsp?topic =/com.sybase.infocenter.dc38151.1510/html/iqrefbb/Alhakeywords.htm) –

答えて

2

は、Sybase IQで

select "Comment" from A 

COMMENT is a reserved wordを試していただき、ありがとうございます。

ここには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"

+0

ありがとうございます! – hydradon

関連する問題