SQL Prompt 10

Inserting columns with the column picker

The Column Picker enables you to select multiple columns for tables or views specified in a SELECT statement or similar syntax.

When the suggestions box is displayed, press Ctrl + Left arrow or click the Column Picker tab to display the Column Picker:

Primary key  and foreign key  columns are indicated by key icons.

The Column Picker is never automatically selected.

  • The columns are listed in the order in which they are defined in the table. Clear the List in table order check box to list them alphabetically.
  • The first column in the list is highlighted, but it is not selected. Only columns that you specifically check will be inserted.

The Column Picker is only available when it is valid syntax to insert more than one column into your code at this point in the query, and there are columns available to insert. For example, the column picker is available for SELECT statements and after ORDER BY, but not in a WHERE clause.

Selecting columns

As you start typing, the list of columns is filtered to show only those that match the typed characters.

  • Use the Up and Down arrow keys to navigate through the list.
  • Press Space to select a column to be inserted.
  • You can select all the columns in the list by pressing Ctrl + A or clicking the Select All button.

If you have already selected some columns and then filtered the list by typing some letters, the previously selected columns are listed at the bottom:

Inserting selected columns

Press Enter or Tab to insert the selected columns. The columns are inserted in the order in which you selected them.

You can also insert the selected columns using any of the other insertion keys you have specified, for example Space or Dot (.) or Comma (,) - see Managing SQL Prompt behavior.

The inserted columns are automatically formatted depending on the options specified in the SQL Prompt Options dialog box (under New lines on the Format > Data Statements page).

If the format of the inserted columns doesn't look the way you want, you can change the formatting options and then apply the new format to the selected code:

From the SQL Prompt menu, select Format SQL.

Qualified column names

Inserted column names are qualified when:

  • you have selected Qualify column names with table name on the Inserted code > Qualification options page, or
  • you have specified more than one table in the FROM clause, and the column names would be ambiguous without also specifying their table

In the example below, both qualification options have been turned on:

In the example below, SQL Prompt has automatically qualified certain column names to avoid ambiguity:

Only those columns that appear in more than one table are qualified.

When Assign aliases is turned on as well as Qualify column names with table name, columns are qualified with the table alias. For example:

You can customize how aliases are created and inserted. For more information, see Working with aliases.

Didn't find what you were looking for?