I have the same problem everytime I connect to SQL server through the SSMS tool. If I have been working on a script and close my laptop for a period of time, when I come back and re-connect it doesnt recognise my tables in the database I am working on. Usually I have to right click on the table name and select top 1000 rows for it to be remembered in the cache. Its a workaround which I know I dont need to do as I am missing something or not doing something correctly.

Any tips?

  • 2
    This usually happens when your default database is master, which is common (and the default i think). When you connect to a server, you will be connected to the master database and thus, intellisense won't recognize those tables because they don't exists in master. If you change the DB in the drop down in the top left of SSMS, you'll see your red squiggly lines disappear. This is the most common reason, assuming you haven't made DDL changes recently Otherwise, maybe your memory is flushing them out... it is a lap top. – scsimon Dec 4 at 14:25
  • Thanks for this, I am using a laptop yes. Where can I see If I am connected to the master database or how to change the default settings on this? – RustyRyan Dec 4 at 14:36
  • I wouldn't change the default personally because if that database goes away or whatever, it's annoying to connect to the instance. if you look in this image where you see AdventurWorks2012 in the top left, that's where you would select your DB. If you want to change your default, it's under the security folder of the server, then edit your logon. – scsimon Dec 4 at 14:46
  • 1
    Your right, that is probably unwise. Thanks for the help :) – RustyRyan Dec 4 at 14:52
up vote 6 down vote accepted

You can refresh the IntelliSense cache with the key shortcut:

ctrl+shift+r

Your query window might have lost its connection as well - just:

Right click on the query window > Connection > Connect

As a little extra: This stackOverflow post discusses custom keyboard shortcuts in ssms - there's loads of custom shortcuts you can setup for anything you might need (in ssms the menu is Tools > Options > Keyboard)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.