How to: Reorder Output Columns

The order in which you add data columns to a Select query determines the order in which they appear in the results. The first column you add to the query appears leftmost in the results, the second column next, and so on.

If you are creating Update or Insert queries, the order in which you add columns affects the order in which data is processed.

To control where a data column appears in the result set, or in what order it is used, you can reorder the columns.

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 reorder columns for output

  1. In the Criteria pane, select the row containing the column by clicking the row selector button to the left of the row.

  2. Point to the row selector button and drag the row to a new location.

    -or-

    Edit the order of the column names in the SQL pane.

Tip

You can add a data row at a specific location in the Criteria pane by inserting a blank row into the Criteria pane, and then specifying the data column to insert. For details, see How to: Add Columns to Queries.

See Also

Other Resources

Sorting and Grouping Query Results

Summarizing Query Results

Performing Basic Operations with Queries