Subject Re: [IBO] IboQuery add fields problem
Author Helen Borrie
At 02:38 AM 19/09/2012, jcfmgmr wrote:
>Hello
>
>When i try to add fields from a iboquery (with this sql: select sum(faccod) from tab_fac ) at design time, on the avaible fields box
>shows the field '"SUM"' ( SUM with double quotes).
>When i try to use this field i get the message .. field '"SUM"' not found.
>Note:
>I only get this error when i connect to a firebird server 2.5 ( Dialect 3; CharSEt WIN1252), If i connect to a firebird server 1.5 ( Dialect 1; CharSEt NONE), evrything works just fine.
>
>Could anybody help ??

Various things have happened with "lazy" SQL in Firebird since v.1.5 to disambiguate behaviour. The names of calculated fields specified without identifiers are a case in point. AFAIU, IBO is trying to do the right thing by double-quoting a field that is a reserved word.

Try it with the proper syntax of

select sum(faccod) AS TOTAL from tab_fac

(The keyword AS is optional, the fieldname can be any valid identifier.)

Helen