Page 1 of 1

how to select a column with a dash in its name

Posted: Mon May 21, 2007 10:53 pm
by RayLade
I need to select from an ODBC progress database, but all the column names have dashes instead of under scores in them.
Can anybody point me to the correct syntax for the select statement and technique.

sorry, but I couldn't find it with search

Posted: Mon May 21, 2007 11:15 pm
by JoshGeorge
Try double quotes around column names / Table Names

Posted: Tue May 22, 2007 1:07 am
by RayLade
that helps the select statement, but one still needs to define the output type. For example select a."cmp-id" as cmp_id from tbl_a a is a valid SQL statement, but in the outputs column section it still expects cmp-id, which can not be entered.

I created a server job to do the same, and although it complains, it does seem to do it.

Is there a way of defining the out put column correctly?

Posted: Tue May 22, 2007 1:12 am
by ray.wurlod
Is this a parallel job or a server job? You've marked the job type as parallel but posted it in the server forum.

The answer will depend upon which it is.

Posted: Tue May 22, 2007 1:20 am
by RayLade
It is a parallel job, but if need be, I could use a server job

Posted: Tue May 22, 2007 1:40 am
by ray.wurlod
In a server ODBC stage, put the double-quoted column names in the Derivation column in the Columns grid. It's these that form the SELECT clause in the generated SELECT statement.

In a parallel ODBC Enterprise stage you're probably easiest to go with user-defined SQL, with double-quoted column names. They only need to coincide with the columns in the Columns grid. Use aliases to the column names in the Columns grid if you want it to be self-documented.

Posted: Tue May 22, 2007 2:04 am
by RayLade
Hey hey, that was cool... i needed to alias the column name a."bad-name" as bad_name before it stopped grumbling. Maybe this is a version 8 thing?

anyway, thanks again for your help ray

Posted: Tue May 22, 2007 7:17 am
by chulett
RayLade wrote:Maybe this is a version 8 thing?
No. :wink: