Using Code Completion - SQL Assistant

Teradata SQL Assistant for Microsoft Windows User Guide

SQL Assistant
Release Number
English (United States)
Last Update
Product Category
Teradata Tools and Utilities

Using Code Completion

SQL Assistant can provide suggestions for the object and built-in function names that can be used.

A drop down list might appear after you type any of the following delimiter characters: space, comma, tab, ||, arithmetic symbols, or comparison symbols.

As you continue to enter the object name, the first item to match is selected in this list. When the item you want is selected, type one of the delimiter characters or press Enter to select and insert that name into your query.

You can type an open parenthesis to accept and insert any function name that requires parenthesis. Only an open parenthesis or the Enter key will accept and insert such a function.

You can close the list by pressing ESC.

Code completion only appears after the keywords and delimeters used within the common Select, Insert, Update and Delete statements are typed, and after the space following Create, Alter, Drop, Modify, Replace, Show, Help and Database keywords. To display a selection list when you have not typed one of the delimiter characters, press Ctrl+Space.

Code completion works differently in SQL Assistant than it does in other editors. SQL Assistant uses the concept of a current database. Initially the current database is set to the default database for the data source. Change this setting by right clicking on a database in the Database Explorer tree and clicking the Use for View Names menu.

When the FROM clause is entered, the suggestion list contains all the views, and (optionally) the tables, in the current database in addition to all the databases currently in the Database Explorer tree under this data source.

SQL Assistant also builds an active list. Each time table or view name in the FROM clause is entered, that object along with any alias name is added to the active list. When entering the Select and Where clauses, these alias names and the columns contained in the objects within the active list appear.

Because objects and their columns are not added to the active list until they have been entered in the FROM clause, type theFROM clause before the remainder of the statement.

The active list continues to grow as additional Select statements or sub-selects are entered. This means that you do not need to enter the FROM clause of your second statement before other parts of the statement if your previous statements referenced the same tables. However, if you switch to a completely different set of tables and views, reduce the size of the dropdown lists by clearing out the active list by right clicking on the data source in the Database Explorer tree and selecting the Clear Column List menu.

Note: If you use the Teradata form of the FROM clause (a simple comma separated list), the last name in the list is not be added to the active list unless you press Ctrl+Shift+Space after the last View/alias name or type the start of the Where clause.

1 Select Tools > Options.

2 Select the Code Editor tab.

3 Select Display Suggestions.

4 [Optional] Select Include Table names.

Only Views are listed if this option is cleared.

5 [Optional] Select Include built-in functions

Note: Selecting the Display suggestions option automatically switches on the DB Tree option Save Database Tree information to disk and reload it at startup. To avoid serious performance impact when the Tables or Views node of a database is expanded, select the DB Tree option Load only column names for Views.