Information générale
Catégorie:
Codage, syntaxe et commandes
>Hello. I ran into a little odd behavior that I would like to clear up.
>In my sql select statement I have;
>
>Select ..., SERVICE.DESC from mytable1, mytable2 .... where .... into cursor myresult order by myfield
>
>Service.desc is a not referred anywhere else in this statement.
>
>I'm using this sql select to gather data for a report. The odd thing is I'm expecting one of the field name to be "desc" from SERVICE.DESC, but instead I'm getting exp_5 as the field name. Since my report form is expecting DESC, it of course error out. So, I have to do something like this "...SERVICE.DESC AS DESC ". Seems a little odd to me that I have to do this.
>
>Does anybody no what is causing this?
>
>Thanks.
In your example service.desc is like a constant and need to be named exlicitly.
For example,
SELECT "Hello" AS someconst ......
In the result set the field would be named exp_1 (for expression #1) if not explicitly named to someconst. Similarly, if the result set would have two fields of the same name, foo, from separate FROM tables, the fields would be renamed foo_a and foo_b since two fields in a table or cursor can't have the same name.
HTH
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement