Problem while loading date into a table

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
Ramendra
Participant
Posts: 1
Joined: Thu Jul 22, 2004 8:01 am

Problem while loading date into a table

Post by Ramendra »

I am facing one problem,
I have hardcoded date vlaue as "1900-01-01" in transformer and loading the same into a table. In
table it is getting converted into "12/31/1899" i.e one day less.
I am using DB2 API stage and in transformer I have coverted the date into StringToDate("2005-01-01","%yyyy-%mm-%dd") .

Any help on this would be appreciated

Thanks!
Ramendra
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The Server version of the DB2 stage wants dates in internal format. I wonder if the same if true for the EE version?
-craig

"You can never have too many knives" -- Logan Nine Fingers
cnguyen
Premium Member
Premium Member
Posts: 31
Joined: Fri May 14, 2004 9:27 am

one day less

Post by cnguyen »

I am experiencing the same issue and wondering if there is an explanation. I have the following PX job:

seq --> xfm --> DB2/UDB API

There is a date field in the incomoing data with YYYY-MM-DD format. The coressponding field in the DB2 database is of type Date. In the tranform stage, I am using the StringToDate function to convert to date data.

The value of the date field in the DB2 table is always one day less.

Thanks
sud
Premium Member
Premium Member
Posts: 366
Joined: Fri Dec 02, 2005 5:00 am
Location: Here I Am

Re: one day less

Post by sud »

cnguyen wrote:I am experiencing the same issue and wondering if there is an explanation. I have the following PX job:

seq --> xfm --> DB2/UDB API

There is a date field in the incomoing data with YYYY-MM-DD format. The coressponding field in the DB2 database is of type Date. In the tranform stage, I am using the StringToDate function to convert to date data.

The value of the date field in the DB2 table is always one day less.

Thanks
Instead of writing to a db2/udb write to a peek and see if you are getting the correct result. This is very weird, unless DS has a HUGE bug in the DB2 stage.
It took me fifteen years to discover I had no talent for ETL, but I couldn't give it up because by that time I was too famous.
cnguyen
Premium Member
Premium Member
Posts: 31
Joined: Fri May 14, 2004 9:27 am

The TZ environment variable needs to be set to GMT

Post by cnguyen »

Technical Support acknowledged that this is a known issue. The workaround was to set TZ=GMT. Once this was set, the correct date was inserted into the Db2 table.

Thanks
Post Reply