How to find max date

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
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

How to find max date

Post by somu_june »

Hi,

Iam getting three date fields X,Y and Z and there data types is varchar(10) . I want to find the maximum date from X,Y and Z and send to the output. Do I need to convert string to Date and then find Maximum of XYZ or can I do it with out converting . The final output data type to which I should map maximum date is Varchar (10)


Thanks,
Somaraju.
somaraju
relati
Participant
Posts: 17
Joined: Mon Oct 01, 2007 12:44 pm

Re: How to find max date

Post by relati »

What is the date format in the Input fields?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can do it without conversion if the date strings are in a sortable format, such as YYYY-MM-DD.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Re: How to find max date

Post by somu_june »

Hi,


It is Varchar(10)




Thanks,
Somaraju
somaraju
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Re: How to find max date

Post by somu_june »

somu_june wrote:Hi,


It is Varchar(10) and it has YYYYMMDD format




Thanks,
Somaraju
somaraju
relati
Participant
Posts: 17
Joined: Mon Oct 01, 2007 12:44 pm

Re: How to find max date

Post by relati »

OK, then you can compare them without converting and pick the max.
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Re: How to find max date

Post by somu_june »

Thanks folks
somaraju
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Please mark thread as Resolved.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply