Problem in modifying sql statement in db2/udb stage

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
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Problem in modifying sql statement in db2/udb stage

Post by somu_june »

Hi,

Iam new to datastage. Iam having a problem with db2/udb enterprise stage . I have sql statement like this for lookup

Select MANDT,EE,VARCOND,SWO......From.... WHERE ..... . I want to modify the Sql statement by adding distinct. When Iam Trying to add this distinct in output page .... general tab .....query type(Enter custom sql statement) Iam getting an error and I am not able to add distinct with option Generate Select Clause from Column list;enter other sql.
In query types which option I have to select to modify my query .


Thanks,
Somu
somaraju
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Try user-defined SQL
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If this is the DB2/UDB Enterprise stage then you're talking about a parallel job. Is it a parallel job? Techniques are different in parallel and server jobs; you have posted in the server forum, yet mentioned the DB2/UDB Enterprise stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Post by somu_june »

Hi,

It's a server job .Its a DB2/UDB stage. Which option I have to select in this four option to make distinct work


Enter Custom SQL statement

Use SQL Builder tool

LOad SQL from a file at run time

Generate SELECT clause from column list;enter other clauses




Thanks,
somu
somaraju
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Custom SQL means that you write the SQL. It must have exactly the columns in its SELECT clause as you have columns in your Columns grid in the stage. Apart from that restriction it can be any SQL statement that is legal for the database and which returns rows containing those columns.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
peterbaun
Premium Member
Premium Member
Posts: 93
Joined: Thu Jul 10, 2003 5:27 am
Location: Denmark
Contact:

Post by peterbaun »

If you for some reason don't want to use custom sql you can in this case still use "generate select clause from column list".

In the derivation field in the DB2 plugin you will have to enter 'distinct ColName' - do check the sql-tab to see that the generated sql looks fine.

Regards
Peter
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

peterbaun wrote:In the derivation field in the DB2 plugin you will have to enter 'distinct ColName'
Exactly. :wink:

Specifically, insert the keyword 'distinct' before the derivation of the first column. Don't use custom sql for something simple like that.
-craig

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