T-SQL IntelliSense in Visual Studio 2010
One of the cool new features in Visual Studio 2010 is T-SQL IntelliSense. Yes, I know you’re thinking, “it’s about time.” Well, when we were implementing this functionality we had to made some difficult decisions about what we would support. So I thought it would be helpful to describe what T-SQL IntelliSense will/will not do in Visual Studio 2010.
The first thing to point out is this functionality is only available in Visual Studio 2010 Professional, Premium and Ultimate SKUs. The second thing to point out is there are actually two implementations of T-SQL IntelliSense in Visual Studio: “Connected” and “Offline.”
Connected IntelliSense is active whenever you are in a T-SQL editor and are connected to a SQL 2008 instance. Note that SQL 2005 is not supported. The identifiers that are listed in the completion list are enumerated by querying the database that is currently selected in the editor’s toolbar. All SQL Server 2008 types are supported by Connected IntelliSense.
Offline IntelliSense is active whenever you are in a T-SQL editor and are editing a .sql file that is part of a SQL Database, SQL Server or Data-tier Application Component project. The identifiers that are listed in the completion list are enumerated by querying the in-memory model representing the contents of your project. This in-memory model contains all the objects in your project that are defined and saved to disk. A subset of the SQL Server 2005/2008 types are supported by Offline IntelliSense
- Inline table function
- Multi Statement Table function
- Scalar Valued function
- Stored Procedure
- User Defined Data Type
- User Defined Table Type
Unlike C# or Visual Basic IntelliSense, T-SQL Offline IntelliSense does not support syntax auto-completion. For example, after type CREATE TABLE Foo, IntelliSense will not auto-complete the remainder of the syntax for defining a table.