If you keep it as a string column, you cannot avoid this.  The only way you
can sort it correctly is to pad the single digits with a leading 0.

This will force:
01
02
03
.....

update
    tblFoo
set
    columnFoo = '0' + columnFoo
where
    cast(columnFoo AS integer) < 10

^---MS SQL solution.

Teddy




On 1/25/07, Chad Gray <[EMAIL PROTECTED]> wrote:
>
> When you use ORDER BY in SQL on a text field it sorts the data like this:
>
> 1
> 11
> 12
> 13
> 2
> 21
> 22
>
> Where I want
> 1
> 2
> 11
> 12
> 13
> 21
> 22
>
> I cannot switch it to an integer field because there will be some text
> also.
>
> Any way to accomplish this?
>
> Thanks!
> Chad
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267598
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to