Default values in target database

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
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Default values in target database

Post by yaminids »

Hello,

I am trying to map some columns in source table to columns in target table. The problem is that for some target table columns there are no source columns specified. I am asked to fill that columns with defaults like 'Null' or to just leave them blank. My question is how can we leave the columns blank while mapping them in 'Transformer' stage, as the stage does'nt allow any columns without derivation.
Can anyone suggest me the correct way to leave some columns blank in the tables of target database.
KeithM
Participant
Posts: 61
Joined: Thu Apr 22, 2004 11:34 am
Contact:

Post by KeithM »

You can enter values in the derivation to get the results you want. You don't have to map a column from your source table to each column in the target table.

If you want a blank just put '' in the derivation. If you want a null value in your target enter @NULL in the derivation.
Keith
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You can change your metadata to be nullable. You could change your derivation to check for null.

if IsNull(input.column) then "default value" else input.column
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can organize for default values to be set in the target database itself. Every column definition is able to have a DEFAULT clause.

Other than that, if the column is updated by DataStage, then DataStage must generate a value with which to update that column. It doesn't matter what you do or how you do it, DataStage must generate a value.

Presumably you want to allocate a default value (a constant) if some particular condition is true - usually that the incoming value from source is NULL. As others have suggested,

Code: Select all

If IsNull(Source.Value) Then defaultvalue Else Source.Value 
is a suitable technique.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Re: Default values in target database

Post by yaminids »

Thank you all for your help. Have a nice day.
yaminids wrote:Hello,

I am trying to map some columns in source table to columns in target table. The problem is that for some target table columns there are no source columns specified. I am asked to fill that columns with defaults like 'Null' or to just leave them blank. My question is how can we leave the columns blank while mapping them in 'Transformer' stage, as the stage does'nt allow any columns without derivation.
Can anyone suggest me the correct way to leave some columns blank in the tables of target database.
Post Reply