Page 1 of 1

user defined query in odbc

Posted: Thu Jul 26, 2012 6:05 pm
by rgr
Hi,
How to write a user defined query in ODBC stage, I know there is user defined option, Here are the details, I have A, B, C columns from the source link and I need to delete the records in target table having col X,Y Z, P, Q, R using where condition X =A and Y=B and Z<=C.

Thanks,
Rgr

Posted: Thu Jul 26, 2012 6:45 pm
by chulett
The best way? Let the stage generate it so you get the bind parameters correct and then... tweak it.

Posted: Fri Jul 27, 2012 5:19 pm
by ray.wurlod
You don't even need user-defined SQL for this. Simply use DataStage to filter the rows needing deleting) and pass them to a straightforward DELETE in the target stage.

Posted: Fri Jul 27, 2012 5:23 pm
by rgr
Thank you craig and ray, I used user defined query as suggested by you.

Posted: Fri Jul 27, 2012 8:59 pm
by chulett
As Ray noted - best practice is to only use "user-defined" SQL when you have no other choice, otherwise let the stage generate the SQL. A "normal" delete will work just fine for this.