Pass values dynamically to SQL code in passive(database)stg.

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
rajeevs
Participant
Posts: 14
Joined: Thu Jan 12, 2006 10:42 am

Pass values dynamically to SQL code in passive(database)stg.

Post by rajeevs »

Could somebody please let me know how to pass a value to a SQL in a passive stage.

Consider i have a ODBC stage and am connecting to a SQL server database. The scenario here is to use a between clause (or) a < > in a sql statement. This value that i would be passing would be dynamic..

Any suggestions would be appreciated !!

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

Post by kcbland »

How about a job parameter? Such as

Code: Select all

table.datecol >= '#YourDateParameter#'
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
rajeevs
Participant
Posts: 14
Joined: Thu Jan 12, 2006 10:42 am

Post by rajeevs »

kcbland wrote:How about a job parameter? Such as

Code: Select all

table.datecol >= '#YourDateParameter#'
...
For a Server job running on windows OS - How do i pass the #dateparemeter# to the SQL stmt ?? Kindly advise..
ssgrpid
Participant
Posts: 25
Joined: Thu Jul 28, 2005 6:05 pm

Post by ssgrpid »

You have to pass the value to the job parameter from the sequencer level.

If dynamic value can generated at the sequencer level, like reading from a file, you can use the execute command activity.

If the value has to be generated using some transformation, you can do that in a seperate job and assign the value to user status. This value can be caught at the sequencer level and can again be passed as a parameter to this job.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Learn about job parameters, use your DS Designer manual for more information. They are the mechanism for feeding dynamic runtime control values to processes from the command line or the controlling processes (Batch, Sequence, custom job control).
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
Post Reply