1

I have a Firebird database with a table foo that have a field called WHEN. Is there a way to perform a query using the field name in SELECT?

This works:

SELECT * FROM foo;

This not:

SELECT WHEN FROM foo;
SQL error code = -104
Token unknown - line 1, column 18
WHEN

Any hints?

1

1 Answer 1

2

The token WHEN is a reserved word, and can't be used as a column name without explicitly quoting it. Either rename the column, or quote it:

select "WHEN" from foo

Be aware that quoting names makes them case sensitive. Unquoted object names in Firebird are case insensitive, but stored in uppercase.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.