2

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?

4
  • 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.
    – S3S
    Dec 4, 2018 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, 2018 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.
    – S3S
    Dec 4, 2018 at 14:46
  • 1
    Your right, that is probably unwise. Thanks for the help :)
    – RustyRyan
    Dec 4, 2018 at 14:52

1 Answer 1

6

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 agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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