Sorting query results

Use the Sort Columns dialog to sort the query results on columns of data.

About this task

Perform the following steps to specify the columns by which the query results are sorted:

Procedure

  1. With query results in the available window, select Results > Sort.

    The Sort Columns dialog box is displayed.

  2. Select the sort orders for the desired columns in the Sort Order fields. Query results are sorted using the column whose sort order is set to 1 first and then based on the column whose sort order is set to 2 and so on.
    Note: You can limit the number of columns that can be used to sort the query result using the DSQCP_SORT_COL_SUPPORTED global variable. You can set a desired value in this global variable or set 0 to allow sort on all columns.
  3. Specify the sort sequence, Ascending or Descending , for the desired columns in the Sort Sequence fields.
  4. Select the sort type for the desired columns in the Sort Type fields.
  5. By default, the Sort string based on locale rules check box is not selected indicating that the query results are sorted based on the comparison of characters according to their Unicode code point values. Select the Sort string based on locale rules check box to sort query results based on a character's position in the national language alphabet that has been defined for the current locale.
  6. Click OK.

    The query results are sorted according to the conditions specified in the Sort Columns dialog box.

    The specified sorting order is saved within the query and used the next time you run it if the DSQQW_QUERY_PRESERVE_SORT global variable is set preserve sorting order (1). If you need to rerun the query without applying the specified sorting order, set the DSQQW_QUERY_PRESERVE_SORT global variable to zero (do not preserve sort order), and then run the query. You will always be able to apply the specified sorting order from the Sort Columns dialog box.