What does the "desc" do at the end of this sql statement

Posted on 2009-12-16
Last Modified: 2012-05-08
Howdy all,

Confused...  I have a view in SQL that orders my outbound call pot.  It was created for me by the software vendor.  Does anyone know what the "desc" does to the following:

ORDER BY dbo.Activity.IPCMPriority DESC, Start_date DESC, Start_Time

When I add a sort on a field it doesnt add it to the field name??

Question by:Smartin
    LVL 26

    Accepted Solution

    it orders the result set in descending order... default is asc meaning ascending.

    Author Closing Comment

    DOH!!!!!  Think before speak  :)
    LVL 26

    Expert Comment

    ORDER BY dbo.Activity.IPCMPriority DESC, Start_date DESC, Start_Time

    here in your example your result set is sorted from bigger value to the smaller value for the IPCMPriority column then sorted by the  Start_date from the newer date to the oldest date ...
    LVL 13

    Expert Comment

    ORDER BY would sort it ASC, DESC depending on what you specify. Default would be ASC.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
    In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    This video discusses moving either the default database or any database to a new volume.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now