how to select a column with a dash in its name

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
RayLade
Charter Member
Charter Member
Posts: 27
Joined: Wed Sep 15, 2004 11:13 pm
Location: Australia, Sydney

how to select a column with a dash in its name

Post 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
Ray Lade
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

Try double quotes around column names / Table Names
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
RayLade
Charter Member
Charter Member
Posts: 27
Joined: Wed Sep 15, 2004 11:13 pm
Location: Australia, Sydney

Post 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?
Ray Lade
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
RayLade
Charter Member
Charter Member
Posts: 27
Joined: Wed Sep 15, 2004 11:13 pm
Location: Australia, Sydney

Post by RayLade »

It is a parallel job, but if need be, I could use a server job
Ray Lade
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
RayLade
Charter Member
Charter Member
Posts: 27
Joined: Wed Sep 15, 2004 11:13 pm
Location: Australia, Sydney

Post 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
Ray Lade
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

RayLade wrote:Maybe this is a version 8 thing?
No. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply