Sql-server – Can SQL Server disable IntelliSense on SSMS

intellisensesql serversql-server-2016ssms

I am using SSMS 2016 (ver: 13.0.15000.23) and connecting to SQL Server database 2016 (ver: 13.0.5081.1).

IntelliSense is not working on my SSMS.

I tried the following:

  • Tools >> Options >> Text Editor >> Transact-SQL >> IntelliSense, and select Enable IntelliSense
  • Tools >> Options >> Text Editor >> Transact-SQL >> General, and verify Auto list members and Parameter information check boxes are checked
  • Query >> IntelliSense Enabled
  • Verify that SQLCMD is disabled
  • Refreshed IntelliSense cache (Ctrl+Shift+R)
  • Making sure no compile errors are in the query
  • Uninstall and reinstall SSMS

I asked other members in my team and IntelliSense only works sporadically for them, if it does.

Question:
Is there a server setting which is disabling IntelliSense on SSMS?


I've already gone through all of these questions:

I have limited permissions on the instance, but I can select and update records in the database I'm working in (I didn't try insert). I can see around 1,600 names of objects and columns by running:

SELECT o.name, c.name 
FROM sys.objects o 
    INNER JOIN sys.columns c ON o.object_id = c.object_id 
WHERE o.is_ms_shipped = 0;

Best Answer

Permissions

As the comment answers you've received so far imply, the most likely reason for this problem is that you don't have the appropriate permissions to that database. This is (rather vaguely) documented here:

Troubleshooting IntelliSense -> Database Engine Query IntelliSense

  • 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.

The easiest way to fix this is to have a DBA grant the "View Definition" privilege to the database user that you're using to connect to this database.

For example, I can create this login, and a database user for a specific database, on my local SQL Server 2016 instance:

USE [master]
GO
CREATE LOGIN [nerd-login] WITH PASSWORD = 'NerdPassword1';


USE [SomeDatabase]
GO
CREATE USER [nerd-user] FOR LOGIN [nerd-login] WITH DEFAULT_SCHEMA=[dbo]
GO

And if I login as nerd-login, I can connect to the SomeDatabase database, but I can't get any intellisense on it. But, after running this command:

USE [SomeDatabase]
GO
GRANT VIEW DEFINITION TO [nerd-user];

I'm able to get intellisense on the objects in the SomeDatabase database.

This can also be granted more broadly at the instance level (by executing GRANT VIEW ANY DEFINITION in the master database context), or at the per-object level.

Latency

In the comments here, you've mentioned:

Server is about 50 miles away, but I do feel there is some issue with network/computer because opening a new browser takes several seconds.

Factors like the amount of metadata in a particular database (# of tables, views, columns, functions, stored procedures, etc), the network speed between you and the database, and how busy the other database is, can all affect intellisense.

Here's a pretty thorough treatment of the latency issue in a blog post from Aaron Bertrand:

Troubleshooting IntelliSense in SQL Server Management Studio 2012

And finally, you may just need to be patient. Check your network speed, the general health of the server, and be understanding if your metadata is quite large - if you are running SAP, for example, there's a lot more data to bring across than AdventureWorks.

When SSMS is attempting to get metadata from the destination server, it may time out before it starts receiving results. This timeout is hard-coded to two seconds in SSMS 2012, but in previous versions, it would wait for the database connection to time out (which could be 30 seconds or more). It will continue trying in the background, so you may not see the drop-down appear right away, but it could appear after successive attempts at pressing Ctrl+J.

You can force it to try to reload by pressing Ctrl+Shift+R or the menu option Edit > IntelliSense > Refresh Local Cache. Once metadata is retrieved in the background, the data is cached in local memory. If the connection is working and none of the above factors are in play, the cache will eventually be populated and you should be able to use all of the functionality.

But again, on SSMS 2008 or SSMS 2008 R2, this may take a little bit longer because of the more relaxed timeout.

Note: I realize that's about SSMS 2012, but the same general principles still apply