Setting default date value

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
lsnovick
Participant
Posts: 80
Joined: Fri May 25, 2007 7:24 am
Location: Troy

Setting default date value

Post by lsnovick »

I need to set a default value into a timestamp field. This does not work:

If IsNull(lnk_PassMbrId.END_DT) Then StringToTimestamp('9999-12-31 00:00:00',"%yyyy-%mm-%dd HH:MM:SS") Else lnk_PassMbrId.END_DT


Any idea on what gets it to work?

Thanks.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Your time format is not correct. Put the following in the format mask

Code: Select all

"%yyyy-%mm-%dd %hh:%nn:%ss"
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Edwink
Participant
Posts: 47
Joined: Sat Aug 19, 2006 4:57 am
Location: Chennai

Post by Edwink »

Can you post the error message?
lsnovick
Participant
Posts: 80
Joined: Fri May 25, 2007 7:24 am
Location: Troy

Post by lsnovick »

APT_CombinedOperatorController,0: Fatal Error: Attempt to setIsNull() on the accessor interfacing to non-nullable field "END_DT".

If IsNull(lnk_PassMbrId.END_DT) Then StringToTimestamp('9999-12-31 00:00:00',"%yyyy-%mm-%dd hh:nn:ss") Else lnk_PassMbrId.END_DT
Edwink
Participant
Posts: 47
Joined: Sat Aug 19, 2006 4:57 am
Location: Chennai

Post by Edwink »

hope DSguru2B reply would solve your problem :)
lsnovick
Participant
Posts: 80
Joined: Fri May 25, 2007 7:24 am
Location: Troy

Post by lsnovick »

Nope. I tried that too.

If IsNull(lnk_PassMbrId.END_DT) Then StringToTimestamp('9999-12-31 00:00:00',"%yyyy-%mm-%dd %hh:%nn:%ss") Else lnk_PassMbrId.END_DT
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What is the error that you got when you applied my method? Are you sure that your incoming empty column is infact NULL and not an empty space?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
lsnovick
Participant
Posts: 80
Joined: Fri May 25, 2007 7:24 am
Location: Troy

Post by lsnovick »

I fixed it by renaming the field coming in and it worked. That is so weird that I can't even understand how it works now. :evil: :evil:
Post Reply