Page 1 of 1

How to find max date

Posted: Wed Jun 04, 2008 2:55 pm
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.

Re: How to find max date

Posted: Wed Jun 04, 2008 3:14 pm
by relati
What is the date format in the Input fields?

Posted: Wed Jun 04, 2008 3:34 pm
by ray.wurlod
You can do it without conversion if the date strings are in a sortable format, such as YYYY-MM-DD.

Re: How to find max date

Posted: Wed Jun 04, 2008 3:34 pm
by somu_june
Hi,


It is Varchar(10)




Thanks,
Somaraju

Re: How to find max date

Posted: Wed Jun 04, 2008 3:36 pm
by somu_june
somu_june wrote:Hi,


It is Varchar(10) and it has YYYYMMDD format




Thanks,
Somaraju

Re: How to find max date

Posted: Wed Jun 04, 2008 3:54 pm
by relati
OK, then you can compare them without converting and pick the max.

Re: How to find max date

Posted: Thu Jun 05, 2008 7:03 am
by somu_june
Thanks folks

Posted: Thu Jun 05, 2008 2:31 pm
by ray.wurlod
Please mark thread as Resolved.