![]() |
|
|
By: Aaron Bertrand | Read Comments | Print Aaron is Senior Consultant at SQL Sentry, Inc., and has been contributing to the community for over a decade, first earning the Microsoft MVP award in 1997. Related Tips: More |
|
IntelliSense can be a very powerful ally for the T-SQL developer. It can significantly reduce keystrokes, prevent you from guessing at object names, make sure you spell them correctly (and use the right case), and can help you understand the interface to several programmable entities such as stored procedures and built-in functions. In Management Studio 2012, there are some enhancements to IntelliSense that will make it even more powerful - including more intelligent caching, and partial keyword matching (so you no longer have to remember what letter the waits DMV *starts* with - just type "waits" and it will narrow it down).
I have seen several cases in forums, newsgroups and on twitter where folks complain that IntelliSense is "not working." Now, "not working" can cover a wide variety of things. For the purpose of this tip, we're going to restrict that to not behaving as designed, as opposed to not behaving as desired (for example, if you don't like that pressing the space bar or tab auto-completes for you, that's a different discussion). I thought it would be useful to list out the common symptoms and how you can try to resolve them. Note that most of these items are also applicable to previous versions.
There are a couple of different symptoms that can lead you to believe that IntelliSense is "not working." One is where the IntelliSense features (auto-complete / list members / tool-tips / underlining invalid references) do not function at all. Another is where the completion list appears, but it does not contain the object(s) you're trying to use.
There are several potential reasons why IntelliSense may not be working at all; some are more obvious than others.


...or by checking that the toolbar icon is enabled:


SELECT and FROM, and try to list members using Ctrl+J:
CREATE TABLE dbo.foo ( i INT CHECK (i IN (SELECT <put cursor here> FROM sys.objects)) );
If you copy the SELECT query alone to another query window and try the same experiment, the completion list will appear (unless you are affected by one of the other issues in this tip).
GO before the current line to see if that temporarily resolves the issue, otherwise you will need to go up and fix the other errors. I haven't noticed this to be an issue in SQL Server 2012 - as long as previous statements are terminated (or the beginning of the current statement is obvious and unambiguous), most IntelliSense functions don't care if there are errors outside of the current statement. SELECT 1;
At first you may see an error message about your connection being disconnected or forcibly closed, depending on your version of Management Studio. You just need to try one more time to remind SSMS that, even though the server was temporarily disconnected, it is still there.
SELECT SERVERPROPERTY('ProductVersion');If this query yields a build number starting with "8." or "9.", then IntelliSense is not working because the target version is not supported.
SELECT SERVERPROPERTY('Edition');If the result is "SQL Azure" then that is why IntelliSense is not working.
There are a number of reasons why the completion list may not actually be complete or that an object or column name is underlined and marked as incorrect. One is quite common, but several others are possible too.
USE command, or if the database is changing in other query windows or by other users. You can refresh the cache by pressing Ctrl+Shift+R or by selecting the menu option Edit > IntelliSense > Refresh Local Cache. As above, you may need to wait for the cache to fully load, depending on the size of your metadata and other resources involved.

These don't show up under the dbo schema in auto-complete either, in case you were wondering.
SQL Server 2012 Books Online outlines a variety of other potential issues in the topic Troubleshooting IntelliSense (SQL Server Management Studio). There are topics for other versions of SQL Server as well: SQL Server 2008 | SQL Server 2008 R2. There's even a SQL Server 2005 topic, presumably added to Books Online at a time when they intended to include IntelliSense in that version of Management Studio (which they never did, of course).
I hope that gives you some avenues to try if you are finding that IntelliSense isn't working (partially or at all). And if you've shied away from IntelliSense in SSMS 2008 or SSMS 2008 R2, I hope you'll give it another shake in SSMS 2012.
| Share: | Share | Tweet |
|
![]() |
![]() |
Connect with MSSQLTips.com |
|
privacy | disclaimer | copyright | advertise | about authors | contribute | feedback | giveaways | user groups Some names and products listed are the registered trademarks of their respective owners. Edgewood Solutions LLC | MSSharePointTips.com | MSSQLTips.com |