As the title says, how am I going to deal with a column name in FBExport that look like a keyword?
this is how my statement looks like:
-Q "SELECT a.ID, a.USERID, a.`WHEN`, a.INOUT FROM ATTENDANT a"
then I get this error:
Engine Code : 335544569
Engine Message :
Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, column 26
WHEN
When I use
"WHEN"
Error: Switches must begin with -
tried 'When'
-Q "SELECT a.ID, a.USERID, a.'WHEN', a.INOUT FROM ATTENDANT a;"
SQL Message : -104
Invalid token
Engine Code : 335544569
Engine Message :
Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, column 26
'WHEN'
Error: Switches must begin with -
What are the correct escape characters?
For dialect 3 database, Firebird allows quoting object names using double quotes (
"<objectname>"). Be aware that quoting object names makes them case sensitive, so"WHEN"is not the same as"when". If your database is dialect 1 then this is not possible, and you should first convert your database to dialect 3.However the problem this is a command line option, meaning that
Is split by your shell to the arguments:
-QSELECT a.ID, a.USERID, a.WHEN, a.INOUT FROM ATTENDANT aWhile you want:
-QSELECT a.ID, a.USERID, a."WHEN", a.INOUT FROM ATTENDANT aTo achieve that, you need to escape the double quote inside the second argument, so:
or - as indicated by a_horse_with_no_name in the comments - wrap the argument in single quotes:
This doesn't really have to do with Firebird or FBExport, but is a result of how your shell (eg bash) parses commandline arguments.