Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Troubleshooting Transact-SQL IntelliSense

Visual Studio 2010

There are certain cases when the IntelliSense options might not work as you expect.

The IntelliSense List Members, Complete Word, Parameter Info, and Quick Info are only available in the Transact-SQL editor under certain conditions. For more information about these features, see Transact-SQL IntelliSense Overview.

There are two primary factors that determine the availability of these features:

  • Connectivity to an instance of SQL Server: When connected to an instance of SQL Server, IntelliSense is available. In this case, the IntelliSense metadata is derived from the connection, even if the file you are editing is associated with a database project.

  • Association with a database project: When the file you are editing with the Transact-SQL editor is associated with a database project, IntelliSense is available. In this case, if you are not connected to an instance of SQL Server, the IntelliSense metadata is derived from the database objects associated with the project.

The following table describes how these factors affect the availability of the features: List Members, Complete Word, Parameter Info, and Quick Info.

Connected to instance of SQL Server?

Associated with database project?

Available

Notes

Yes

Yes

Yes

Connection-based IntelliSense

Yes

No

Yes

Connection-based IntelliSense

No

Yes

Yes

Project-based IntelliSense

No

No

No

When the Transact-SQL editor is connected to an instance of SQL Server, IntelliSense is available and shows objects associated with that database connection. When the Transact-SQL editor is not connected to an instance of SQL Server, IntelliSense information comes from objects associated with the database project. If the Transact-SQL editor is not connected to an instance of SQL Server nor is associated with a database project, no IntelliSense is available.

The IntelliSense parsing features and Transact-SQL Code Snippets feature are always available, even when the editor is not associated with a project or connected to an instance of SQL Server.

The following conditions might affect the behavior of IntelliSense:

  • There is a code error above the cursor.

    If there is an incomplete statement or other coding error above the location of the insertion point, IntelliSense may be unable to parse the code elements, and therefore will not work. You can comment out the applicable code to enable IntelliSense again.

  • The insertion point is inside a code comment.

    IntelliSense options are not available when the insertion point is within a comment in your source file.

  • The insertion point is inside a string literal.

    IntelliSense options are not available when the insertion point is inside the quotation marks around a string literal, for example:

    WHERE FirstName LIKE 'Patri%|'

  • The feature is turned off.

    Many IntelliSense features work automatically by default, but you can disable any feature.

Even when the Complete Word feature is disabled, you can use other IntelliSense features. For more information, see Modifying IntelliSense Options.

The following issues apply to the Transact-SQL editor:

  • The IntelliSense functionality of the Transact-SQL editor does not support all Transact-SQL syntax elements. Parameter help does not support the parameters in some objects, such as extended stored procedures. For more information, see Transact-SQL Syntax Supported by IntelliSense.

  • IntelliSense is not available in the Transact-SQL editor when connected to versions of the SQL Server Database Engine earlier than SQL Server 2008.

  • IntelliSense is not available in the Transact-SQL editor when your Transact-SQL editor is not associated with a project and your Transact-SQL editor is not connected to a database engine.

  • IntelliSense is turned off in the Transact-SQL editor when the SQLCMD mode is set on.

  • IntelliSense functionality does not cover database objects created by another connection after your editor window connected to the database. You can choose one of these three mechanisms to refresh the cache of objects for your editor window:

  • When connected to an instance of SQL Server, the IntelliSense cache will not reflect the changes made if you or other users execute CREATE, ALTER, or DROP commands on that instance during your Transact-SQL editing session. To update the IntelliSense cache, select the Edit menu, select IntelliSense, and then select Refresh Local Cache.

  • Use the keyboard shortcut CTRL+K followed by CTRL+R.

  • Completion lists do not include database objects for which you do not have permissions. IntelliSense flags references to objects for which you do have permissions. For example, if you open a script that is written by someone else, any references to objects for which that person has permissions and you do not are flagged as incorrect.

  • Completion lists might stop working if you lose the connection to the instance of the SQL Server. Reconnect to the instance.

Show:
© 2015 Microsoft