DATE FORMAT

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
adams06
Participant
Posts: 92
Joined: Sun Mar 12, 2006 3:00 pm

DATE FORMAT

Post by adams06 »

I AM GETTING DATE IN THIS FORMAT

EX:

SOURCE IS ORAOCI9 STAGE

42606------------> MMDDYY
120105------------>MMDDYY
112805------------>MMDDYY


TARGET IS ORAOCI9

CAN ANY ONE TELL ME HOW TO FORMAT THE ABOVE INTO YYYYMMDD FORMAT.

THANKS IN ADVANCE
phanee_k
Charter Member
Charter Member
Posts: 68
Joined: Thu Nov 20, 2003 11:02 pm

Post by phanee_k »

Use the Iconv / OConv functions to convert the date into the date format that you need.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

to be a little more specific, use

Code: Select all

OCONV(ICONV(FMT(In.date,"6'0'R"),"DMDY[1,1,2]"),"DYMD[4,2,2]")
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: DATE FORMAT

Post by gateleys »

This has been discussed in many many postings in this forum. It would be nice if you clicked here.

gateleys
mdtauseefhussain
Participant
Posts: 38
Joined: Mon Feb 27, 2006 10:34 pm
Location: Chennai
Contact:

HI!

Post by mdtauseefhussain »

You can use TO_CHAR(COLUMN NAME,'YYYYMMDD') in the source query
Mohammed Tausif Hussain Sheikh
Cognizant technologies,Perungudi
Chennai
adams06
Participant
Posts: 92
Joined: Sun Mar 12, 2006 3:00 pm

date problem

Post by adams06 »

Hi

if i use this code i am getting the following error:


data for column exceeds column width (8), row 33 (approx), data = 2006/08/22

My Target column length is 8 and sql type is varchar.


DSguru2B wrote:to be a little more specific, use

Code: Select all

OCONV(ICONV(FMT(In.date,"6'0'R"),"DMDY[1,1,2]"),"DYMD[4,2,2]")
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

My reply was based on the the input data in your original post.
Please tell me what is going to be your input data and what it should look like. Exactly.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

try this

Code: Select all

DIGITS(OCONV(ICONV(FMT(In.date,"6'0'R"),"DMDY[1,1,2]"),"DYMD[4,2,2]") )
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
diamondabhi
Premium Member
Premium Member
Posts: 108
Joined: Sat Feb 05, 2005 6:52 pm
Location: US

Post by diamondabhi »

so you wnat the length to be 8?
Every great mistake has a halfway moment, a split second when it can be recalled and perhaps remedied.
diamondabhi
Premium Member
Premium Member
Posts: 108
Joined: Sat Feb 05, 2005 6:52 pm
Location: US

Post by diamondabhi »

Then load the column into a stage variable and trim the special character and then load into the table.
Every great mistake has a halfway moment, a split second when it can be recalled and perhaps remedied.
adams06
Participant
Posts: 92
Joined: Sun Mar 12, 2006 3:00 pm

Post by adams06 »

It worked.

Thank you

DSguru2B wrote:try this

Code: Select all

DIGITS(OCONV(ICONV(FMT(In.date,"6'0'R"),"DMDY[1,1,2]"),"DYMD[4,2,2]") )
Post Reply