Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
Database Engine
Development
 How to: Sort in Ascending or Descen...

  Switch on low bandwidth view
Community Content
In this section
Statistics Annotations (0)
Other versions are also available for the following:
SQL Server 2008 Books Online (June 2009)
How to: Sort in Ascending or Descending Order (Visual Database Tools)

You can sort query results in ascending or descending order on one or more of the columns in the result set by using the ASC or DESC keywords with the ORDER BY clause.

ms190986.note(en-us,SQL.100).gifNote:
The sort order is determined in part by the column's collation sequence. You can change the collation sequence in the Collation Dialog Box.

The following procedure assumes that you have a query open in Query and View Designer that uses the ORDER BY clause to sort one or more columns.

  1. In the Criteria pane, click the Sort Type field for the column that you want to reorder.

  2. Choose Ascending or Descending to specify the sort order for the column.

Notice that as you work in the Criteria pane, your query's UNION clause changes to match your most recent actions.

ms190986.note(en-us,SQL.100).gifNote:
When sorting results by more than one column, specify the order in which columns are searched relative to each other by using the Sort Order column. For more information, see How to: Sort Multiple Columns in Queries (Visual Database Tools).

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker