Statement Expansion

The topic describes how to expand SQL statements.

Query Formatting Overview

Wildcard expansion

The feature allows you to replace the asterisk (*) symbol with the list of columns from the required table or view with help of the Tab key.

Inserting columns list on pressing Tab*

You can insert a list of columns available for required objects (tables, views, etc.) of the FROM list instead of the * symbol by pressing the Tab key. If such list can be inserted, a hint is displayed when the pointer is placed after the * symbol.

Expand * in SELECT on Tab

Expanding stored procedures*

This feature allows to simplify debugging by replacing a call to a stored procedure with the stored procedure body - it takes the content of a stored procedure and substitutes the call in your query for it. To apply this feature to the required code, click the Convert EXEC to Script option on the shortcut menu.

Convert Exec to Script

Expanding INSERT, ALTER, EXEC, UPDATE statements**

This feature allows typing available table names, views, procedures, functions or triggers in ALTER, INSERT, EXEC, and UPDATE statements and then expand the statement to the full template by pressing the Tab key.

In UPDATE statements, a full list of columns from a specified table is inserted into the code you are typing.

Apart from the template, the type of column data will be generated in the comments along with the NOT NULL and ROWGUID properties. For datetime, a template for inserting time will be created. Also a DEFAULT clause is generated if a default value is created for a table.

Note
dbForge SQL Complete will not offer to expand the ALTER statement for encrypted triggers, views, procedures and functions .

expandinsert-statement

Execute current statement

You can execute the current SQL statement without selecting it. You just need to place the pointer over the statement and press Ctrl+Shift+E or Alt+Enter - and dbForge SQL Complete will define statement boundaries itself.

execute-current-statement-SSMS

Note
* These features are available in the Standard edition of SQL Complete only.
** The Express edition of SQL Complete offers partial support of these features. Full support is available in the Standard edition only.