Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Sorting issue for numbers Expand / Collapse
Author
Message
Posted Wednesday, April 8, 2009 5:09 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, May 9, 2012 10:59 PM
Points: 229, Visits: 870
Hi All,

I kept sorting for S.No in my report. While i'm sorting the numbers are sort in 1,10,100,2,20,3,30 order but i want 1,2,3,10,20,30,100. Please help me to solve this issue


-----------------------------------------------------------------------------------------------------------------------------------------------------------
Please feel free to let me know if you are not clear or I’ve misunderstood anything.

Thanks,
Arunkumar S P

Post #692937
Posted Wednesday, April 8, 2009 5:13 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, May 30, 2014 6:27 PM
Points: 2,808, Visits: 7,175
It looks like the numbers are stored in a Char/Varchar column.

Convert them to an Integer then sort by the Integer data.

Post #692941
Posted Wednesday, April 8, 2009 5:16 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, May 9, 2012 10:59 PM
Points: 229, Visits: 870
Thanks for your quick respone. Where to convert ? . In sql(dataset) or by using expression.

-----------------------------------------------------------------------------------------------------------------------------------------------------------
Please feel free to let me know if you are not clear or I’ve misunderstood anything.

Thanks,
Arunkumar S P

Post #692943
Posted Wednesday, April 8, 2009 5:19 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, May 30, 2014 6:27 PM
Points: 2,808, Visits: 7,175
It depends, it you are only storing Numbers in the column then the datatype should be really a Numeric data type.

Otherwise i would do a conversion on the stored procedure/ View that you use to access the data.


Post #692944
Posted Wednesday, April 8, 2009 6:08 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, May 9, 2012 10:59 PM
Points: 229, Visits: 870
Thanks Steveb . Its working

-----------------------------------------------------------------------------------------------------------------------------------------------------------
Please feel free to let me know if you are not clear or I’ve misunderstood anything.

Thanks,
Arunkumar S P

Post #692979
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse