Udostępnij za pośrednictwem


How to: Create Column Aliases

You can create aliases for column names to make it easier to work with column names, calculations, and summary values. For example, you can create a column alias to:

  • Create a column name, such as "Total Amount," for an expression such as (quantity * unit_price) or for an aggregate function.

  • Create a shortened form of a column name, such as "d_id" for "discounts.stor_id."

After you have defined a column alias, you can use the alias in a Select query to specify query output.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To create a column alias

  1. In the Criteria Pane, locate the row containing the data column for which you want to create an alias, and if necessary, mark it for output. If the data column is not already in the grid, add it.

  2. In the Alias column for that row, enter the alias. The alias must follow all naming conventions for SQL. If the alias name you enter contains spaces, the Query and View Designer automatically puts delimiters around it.

See Also

Tasks

How to: Add Columns to Queries

Other Resources

Sorting and Grouping Query Results

Summarizing Query Results

Performing Basic Operations with Queries