Page 1 of 1

sort

Posted: Tue Jun 17, 2008 1:19 am
by veera24
hi all,
When I've tried to sort the time field using Sort Stage, it didn't get work out. So that I've converted the time field value using iconv function. Is there any direct way of sorting then pls. let me know.

Your time will be highly appreciated...

Thanks in advance...
veera...

Posted: Tue Jun 17, 2008 1:24 am
by ArndW
Can you explain what didn't work? DataStage server internal time is an integer (number of seconds since midnight) so it will sort correctly. If you somehow declare this as a character then it will not sort appropriately, so part of the question back is to ask how you are sorting.

Posted: Tue Jun 17, 2008 2:46 am
by DSRajesh
What exactly error you are facing when sorting and is the metadata for that date column is of what type as ARNDW says..........?

Posted: Wed Jun 18, 2008 9:55 pm
by veera24
ArndW wrote:Can you explain what didn't work? DataStage server internal time is an integer (number of seconds since midnight) so it will sort correctly. If you somehow declare this as a character then it will not sort appropriately, so part of the question back is to ask how you are sorting.

no.. If i sort the timestamp field directly, then it didn get work out. I've kept the datatype as timestamp only. I meant to say it was not properly been sorted.
So that i've changed the value using iconv function then it went fine. Now my question is, whether sort stage will support for sorting timestamp field directly or should we use iconv function? Meanwhile if there is any other way of sorting the timestamp, pls. let me know.

Posted: Tue Jul 01, 2008 9:28 pm
by veera24
ArndW wrote:Can you explain what didn't work? DataStage server internal time is an integer (number of seconds since midnight) so it will sort correctly. If you somehow declare this as a character then it will not sort appropriately, so part of the question back is to ask how you are sorting.
hi arndw,

Let me explain the situation in detail.

I was in need to sort the dates. My datatype was timestamp only. I've used sort stage to sort the data. But the output was not proper. I mean, it was not being sorted. So that i've used iconv function and then sorted.

What am asking is, why the data has not been sorted regularly when the value for the column was date (say, 1995-01-03). Should i always use iconv function or i use directly?

Hope you will get my point..

Your time will be highly appreciated.

Thanks in advance...
veera...

Posted: Wed Jul 02, 2008 12:36 am
by ray.wurlod
It should not matter. The ISO 8601 standard prescribes yyyy-mm-dd and yyyy-mm-dd hh:mm:ss formats precisely because they can be sorted as strings without conversion.

Can you please explain, therefore, what you mean by "not working", preferably with examples?

Posted: Wed Jul 02, 2008 12:37 am
by ArndW
Server has no concept of dates or timestamps. If you data is in the form "2008-07-01" (i.e. YYYY-MM-DD) then if you sort it, it will be done as a string and will sort correctly, this wouldn't work with a format of DD-MM-YYYY.