(ASC/DESC Order) - Teradata Warehouse Miner

Teradata® Warehouse Miner™ User Guide - Volume 2ADS Generation

Teradata Warehouse Miner
Release Number
November 2018
English (United States)
Last Update
Product Category

An (ASC/DESC Order) element can be used in a Sort Expressions folder with any of the Ordered Analytical functions to specify a sort direction, either ascending or descending. The appropriate SQL keyword, either ASC or DESC, is automatically added to the SQL generated for the expression placed under the (ASC/DESC Order) node in the tree. If an (ASC/DESC Order) element is not used, the default sort direction is given, depending on the Ordered Analytical function in use.

An example of an “(ASC/DESC Order)” in a Sort Expressions folder is given below.

Variable Creation > Input > Variables: SQL Elements pane - Logical > Ordered Expression

In order to set the sort direction the user must either highlight the (ASC/DESC Order) node and click Properties, or double-click on the (ASC/DESC Order) node to display the following Properties panel.

Variable Creation > Input > Variables: SQL Elements pane - Ordered Analytical > Ordered Expression Properties

The Properties dialog presents two properties to set: Sort Order and Null Values in Sort Order.
  • Sort Order defines the order in which values will be sorted, ascending from least to greatest or descending from greatest to least.
  • Null Values in Sort Order defines where to put null values found during the sorting process.
A selection of Nulls first will put null values before all other sorted values, while a selection of Nulls last will put null values after all other sorted values.

Clicking OK will cause the selected Sort Order and Null Values in Sort Order to be used.