Subject | Re: ORDER BY as number when not |
---|---|
Author | Alexander V.Nevsky |
Post date | 2003-05-31T09:56:30Z |
--- In ib-support@yahoogroups.com, Paul Vinkenoog <paul@v...> wrote:
will contain only digits. More general solution I think will be store
such a columns with leading spaces or add them on select using UDF.
Best regards, Alexander.
> Hi Todd,Unfortunately this will work only if values in selected strings
>
> [ order by cast suggestion: ]
>
> > Yes, tried that. no luck
>
> OK, too bad. This one works however:
>
> select cast ( my_char_column as <int or float type here> )
> , ...
> , ...
> from mytable
> order by 1
>
> Or define computed columns for the casts and order on those columns
> when you need to. If you need to do that often, add real numerical
> columns and populate them in after insert/update triggers.
will contain only digits. More general solution I think will be store
such a columns with leading spaces or add them on select using UDF.
Best regards, Alexander.