General information
Category:
Coding, syntax & commands
>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
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only