How to order by a varchar

Hi,
I need to sort a varcar column in numeric order. The if the
query contains more than 99 records, record 100th and greater get
displayed right after 10. In the database schema this column should
have been designed as a numeric type, but I have to work with what
I have.
So instead of getting a sort order of 1,2,3...99,100, 200,
the query returns 1,2,3...10,100,101...11,12,....
Any ideas as to how I should address this issue? I'm using
Order by sort_id ASC

Your UPDATE clause is not going to work because there is no
where clause so your entire table will be set to the same value
based on whatever sortid is set to.
IMHO, if you opt to go through the hassle of rewriting the
data to zero fill, I would go one step further and change the
column to an integer instead of a varchar. Otherwise, I would use
JR's example.

Similar Messages

  • Ordering data type varchar

    I keep forgetting on how to order a column with datatype varchar
    One of my column for pricing has these values: 5,12,15,18,21,23,31 etc when I cfoutput my query result I got the list showing as: 12,15,18,21,23,31,5
    It should be from less price to higher prices: 5,12,15,18,21,23,31 but I can't make this happening because the datatype for this column is varchar.
    I know there is a way around but I can't remember, can someone help me?
    My query is real simple:
    select ranges, prices
    from fees
    order by prices and this doesn't work

    You don't specify what database system you are on.  Assuming SQL Server, how about:
    order by CAST(prices AS decimal(8,2))
    That assumes you might have prices that are not whole units of currency (up to six digits to the left of the decimal and two to the right).  You might need to adjust the scale and precision to your needs.  If the prices are always whole units of currency, then you could replace "decimal(8,2)" with "int".
    -Carl V.

  • Hi , I have just created an iphotobook and when i moved on to order it , it could be only shipped to Australia and U.S.As, I live in Greece do you have any idea of how to order it and deliver it in Athens, Greece ?

    Hi , I have just created an iphoto book but when I was about to order it , i realised that iphoto books can only be shipped to Australia and USA . Does anyone have any idea how to order and deliver the book in Athens , Greece ?????

    No 
    Here is a list of the countries supported for print products  --  http://store.apple.com/us/help/print_products/routing
    in teh past I have seen some people report that they were able to pick a nearby country and use their shipping address - I have not done this and have no idea what the results were
    LN

  • How to order the photos in a slideshow

    how to order the photos in a slideshow

    Just like for any other photo - select the photos in the album and use the command "File > Order Prints".
    Be careful, not to include any text slides. If it is difficult to select the photos in the slideshow, create a new album from the photos in the film strip (File > New Album).

  • How to order / group a report by a placeholder column ?

    How to order / group a report by a placeholder column populated by the group filter ?
    In more detail .....
    My Data model editor's select statement brings back (say 1000 rows) from the database.
    The group filter decides (on performing certain validations) whether to print a row or not in the report.
    Additionally the group filter calculates a "rule type" (just a rule number to say on basis of what rule, the row was selected)
    I would like to order/group the report on the placeholder column which was calculated by the group filter ?
    Obviously, I won't be able to add the "ORDER BY :CP_RULE_NUMBER" in the sql statement as the placeholer column cp_rule_number
    is determined by the group filter level only. (If I do, I get a frequency error)
    Any ideas ?
    Thanks in advance.
    Edited by: user553361 on 8/10/2008 17:35

    how is the group filter implemented?
    If its pure PL/SQL, what about putting the filter-procedure in a stored function into the database? Then you could use the group filter in your query.

  • How Production Order finish date and time is being comptued by SAP?

    Hello Expert,
    How Production Order finish date and time is being comptued by SAP? for example, we create a Production Order via CO01, the basic start date is 29.09.2008 and time is 04:00 it gives us basic finish date is 29.09.2008 and time is 13:28.
    how does SAP compute the time 13:28 as it finished time
    Please explain me briefly.
    Thanks
    Ryan

    Hello Guys,
    When we create Production Order in R/3 the time is calculated by routing but it is extended at SetUp machine time. It is not correct?. SetUp imachines time used only for first Production Order for the same product and it is plan manually, for others Production Order we need calculate time for production without SetUp machine time being pick up to compute finish time. how could we achieve this? only those Machine time will be check.
    thanks

  • Very urgent :how I order by my report within the report option not change i

    Hi master
    Sir I design the report but I need my report order by cheq_no now my report order by voucher no but If I change in query then my format must be change that very problem for me I again design
    Is any option in report through which I order by my report as per my require column I is if I need on cheq_no , voucher_no or date
    Please give me idea how I order by my report within the report option not change in report query
    Thanking you
    aamir

    Use a lexical parameter (see online help):
    select ...
    order by &sort_parameter

  • [svn:fx-trunk] 11118: Did some code cleanup on the Spark components to enforce the conventions about how to order stuff within an AS file .

    Revision: 11118
    Author:   [email protected]
    Date:     2009-10-23 16:35:38 -0700 (Fri, 23 Oct 2009)
    Log Message:
    Did some code cleanup on the Spark components to enforce the conventions about how to order stuff within an AS file.
    QE notes: None
    Doc notes: None
    Bugs: None
    Reviewer: None; no functional changes
    Tests run: ant checkintests
    Is noteworthy for integration: No
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/ButtonBar.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/CheckBox.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DropDownList.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/List.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/NumericStepper.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Panel.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RadioButton.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Spinner.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TextArea.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TextInput.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBase.a s
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTex tBase.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/Slider.as

    Hi Rod,
    different sources (i.e. different branches) are mapped to different local folders in your workspace - in fact you cant map two different server folder to the same local folder.
    In you example the mapping would be (for example) like this:
    Server path                                                          
    local path
    $/../WpfHelloWorld                                                
    C:\Src\WpfHelloWorld
    $/../WpfHelloWorldDev                                           
    C:\Src\WpfHelloWorldDev             
    You can see your Workspace mappings when you select "Workspaces..." in the Workspace selection drop down:
    Within the "Manage Workspaces" dialog select your workspace and klick "Edit" to see and edit all you mappings.

  • Creative Zen - how to order playlis

    I just got the new creative zen but I can't figure out how to order the playlists. When I create a new one, it orders it alphabetically. In media explorer, if I drag/drop it to a new place, it doesn't fall into the new position, it adds all the songs from that playlist to the one I just dropped it on. It never "fits" in between the other playlists.

    "Because wma files take less space than mp3 files. "
    That is a myth. For lower bitratrate files, such as 6 kbps or 32 kbps, WMA files will sound a bit better than mp3 files at the same bitrate. Files at such low bitrates are typically lectures and podcasts, and not music. Music files are usually 28 kbps and up. At
    those bitrates, there is little quality difference between WMA and MP3 files at the same bitrate. WMA files do take more processor power to decode though, so expect shorter battery life when playing WMA files rather than mp3 files. Furthermore, recompressing files that are already compressed will result in lower sound quality. For example, if you have some mp3 files at 256 kbps and want them on your player at 60 kbps to save space, you should make the 60 kbps mp3 files from the CD, and not from the 256 kbps mp3 files if you want the 60 kbps mp3 files to be the best quality they can be.

  • Hi how to order iPhone 5 with delivery to Russia

    hi how to order iPhone 5 with delivery to Russia???

    The apple online stores don't ship outside of their own countries, so you will either need to use one of the premium resellers that is within Russia or find another online store that will ship overseas.

  • How production order create in MTS scenario

    hi
    Actually production order created based on Sales order,through MRP run(md02,04) , it will check the stock(avilability control), if it has less stock than sales it create the production order.
    Based on demand planning , we want to start the production ,so how production order created, we need to create directly CO01, OR  any process is there
    plz reply
    regards,
    sowmya

    Actually production order created based on Sales order,through MRP run(md02,04) , it will check the stock(avilability control), if it has less stock than sales it create the production order.
                I feel this is existing process of your client
    Based on demand planning , we want to start the production ,so how production order created, we need to create directly CO01, OR  any process is there
    1) If you want to consider both MTS and sale order in production then maintain strategy group 40 in MRP 3 view
    2) Create a PIR ( plan) in MD61
    3) Run a MRP in MD02/MD01
    4) As a result of MRP, you will get a plan order
    5) convert the plan order into production order in MD04

  • HT1338 Power Mac G5 have a Mac OS X 10.5.8 how I order Mavericks?

    Power Mac G5 have a Mac OS X 10.5.8 how I order Mavericks?

    A PowerMac G5 can't run 10.6 either.
    Allan

  • How to pull sales orders based on a Campaign??( I have created one Campaign and i need to know,for how many orders it was applicable)

    How to pull sales orders based on a Campaign ID??( I have created one Campaign and i need to know,for how many orders it was applicable)

    Hello,
    as far I understand you are talking about campaign determination. Once a sales order is generated having a campaign determined the campaign creates a reference to the sales order. The best way to track the assigned sales orders is using the related transactions function:
    The same feature is available for trade promotions as well.
    The data is available in table CRMD_BRELVONAE - you can also write a report selecting on OBJGUID_A_SEL with the campaign or TP guid and OBJTYPE_A_SEL with BUS2010020 for campaigns and BUS2010030 for trade promotions.
    Is this answering your questions?
    best regards,
    Johannes

  • How to order recovery disks

    i have hp g62-352ca laptop and i didnot have recovery disks so how to order to get recovery disks

    Prash.
    https://h10025.www1.hp.com/ewfrf/wc/mediaOrder?softwareitem=630247-121&cc=us&dlc=en&lc=en&os=4063&pr...
    REO
    HP Expert Tester "Now testing HP Pavilion 15t i3-4030U Win8.1, 6GB RAM and 750GB HDD"
    Loaner Program”HP Split 13 x2 13r010dx i3-4012Y Win8.1, 4GB RAM and 500GB Hybrid HDD”
    Microsoft Registered Refurbisher
    Registered Microsoft Partner
    Apple Certified Macintosh Technician Certification in progress.

  • How to order iphone 4 without contract on applestore website?

    How to order iphone 4 without contract on applestore website?
    When I choose iphone 4 16G Black, and applestore website ask me if I am AT&T wireless customer..I am not.
    How can I continue?

    QB_Gunslinger12 wrote:
    You'll have to order directly through ATT
    I assume he wants one not locked to AT&T, not only no contract. Any iPhone AT&T sells will be locked to AT&T.
    BUT .. you can buy unlocked iPhone 4 from Apple Canada:
    "Your new iPhone. Direct from Apple and ready to use.
    When you purchase your iPhone from the Apple Online Store, you’ll get it commitment-free. So you can sign up for service with the carrier of your choice and change your carrier at any time. Questions? Call our iPhone experts at 1-800-MY-APPLE."
    but I think this is only on line and likely must be shipped to a Canadian address.
    Phil

Maybe you are looking for