Subject Re: problem with column names starting with number character
Author Svein Erling
> Hi,
>
> I'm facing a problem creating a SQL to retrieve data from a table.
>
> the table has two columns starting with number in the name the two columns are: 6mes, 12mes.
>
> Then when I try to execute the folowwing SQL:
> SELECT tb.6mes,tb.12mes from biz_table tb;
>
> it gives me the following error:
> GDS Exception. 335544569. Dynamic SQL Error
> SQL error code = -104
> Token unknown - line 1, column 10
> .6
>
> How can I build this SQL, in order to get these data?
> I'm using hibernate with jaybird JDBC driver. But even when I try to execute through a SQL executor problem it gives me same problem.
>
> Setup:
> Firebird 2.1 (x64)
> Jaybird 2.1.6
> Windows S.O.
>
> Do you know how to deal with it?

Try

SELECT tb."6mes",tb."12mes" from biz_table tb;

Field names starting with digits are only allowed if they're enclosed in double quotes, something that also make the field name case sensitive. Only you know whether the fields are created with lowercase, uppercase or mixed case, and you may have to change the case of 'mes'.

HTH,
Set