Share via


Transact-SQL IntelliSense Overview

IntelliSense provides several features to make your Transact-SQL programming experience more productive. When using the Transact-SQL editor, IntelliSense offers lists of database object from your current project or connection and automatically inserts them into your code based on your selection. IntelliSense can complete words for you and provide tool tips that describe functions, parameters, and stored procedures.

In addition to menus and tool tips, IntelliSense also provides code parsing features that make it easier to read your code. Delimiter matching helps you to identify code blocks and collapsible code regions make it easier to work in large SQL files.

You can also insert complete code snippets for common Transact-SQL programming patterns. For more information, see Using Transact-SQL Code Snippets.

Using IntelliSense Online and Offline

The IntelliSense features: List Members, Complete Word, Parameter Info, and Quick Info are only available in the Transact-SQL editor under certain conditions. The availability of these features depends on two factors: if the file you are editing is associated with a database project and if you are connected to an instance of SQL Server. For more information, see Troubleshooting Transact-SQL IntelliSense.

The following IntelliSense features are always available, even when the editor is not associated with a project or connected to an instance of SQL Server.

  • Code colorization

  • Delimiter matching

  • Collapsible code regions

  • Transact-SQL Code Snippets

In order to use List Members, Complete Word, Parameter Info, and Quick Info, the .sql file must either be part of a Visual Studio project or connected to an instance of SQL Server.

List Members

The List Members feature provides a list of valid database objects based on the Transact-SQL syntax that you type into the Transact-SQL editor. After selecting a member in the list, press ENTER or TAB to insert that member into your code. For more information, see List Members.

Ee362021.sqleditor_membercompletion(en-us,VS.100).gif

Complete Word

The Complete Word feature types the rest of a variable, command, or function name after you have entered enough characters to uniquely identify the term. For more information, see Complete Word.

Ee362021.sqleditor_completeword(en-us,VS.100).gif

Parameter Info

The Parameter Info feature opens a parameters list that provides information about the number, names, and types of the parameters that are required by a function or stored procedure. The parameter in bold indicates the current parameter that is required as you type a function or stored procedure.

The parameter list is also displayed for nested functions. If you type a function as a parameter to another function, the parameter list displays the parameters for the inner function. Then, when the inner function parameter list is complete, the parameter list reverts to displaying the outer function parameters. For more information, see Parameter Info.

Ee362021.sqleditor_parameterinfo(en-us,VS.100).gif

Quick Info

The Quick Info feature displays the complete declaration for any identifier in your code. When you move the mouse pointer over an identifier, its declaration is displayed in a yellow pop-up window. For more information, see Quick Info.

Ee362021.sqleditor_quickinfo(en-us,VS.100).gif

Note

The Quick Info feature for Transact-SQL is only available for those identifiers supported by IntelliSense. For more information, see Transact-SQL Syntax Supported by IntelliSense.

Parsing Features

To make it easier to read your code, the Transact-SQL editor offers code colorization, delimiter matching, and collapsible code regions. The Transact-SQL editor delimiter matching gives you immediate feedback on whether syntax elements that must be coded in pairs are correctly paired. For example, when grouping by parenthesis or BEGIN and END, matching pairs are highlighted in the editor as you type them. For more information, see Using Transact-SQL Delimiter Matching.

The Transact-SQL editor also allows you to collapse blocks of code that are inside of delimiter pairs. Clicking the box with the minus sign collapses the following code block.

Ee362021.S_Table_Create2(en-us,VS.100).gif

Clicking the box with the plus sign restores the code block.

Ee362021.S_Table_Create3(en-us,VS.100).gif

Code Snippets

The Transact-SQL Code Snippets feature allows you to quickly code common Transact-SQL programming patterns. Use the IntelliSense menus to select the type of snippet you want. After the snippet is created, use the TAB key to move to syntax that you may want to change. The following image shows the Transact-SQL Code Snippet menu that was used to create the CREATE TABLE statement in the previous example. For more information, see Using Transact-SQL Code Snippets.

Ee362021.S_Table_Create1(en-us,VS.100).gif

See Also

Concepts

Using Transact-SQL Delimiter Matching

Using Transact-SQL Code Snippets

Troubleshooting Transact-SQL IntelliSense

Transact-SQL Syntax Supported by IntelliSense