How to Get SSMS to Recognize an Existing Object (Refreshing Lists in SSMS)

Home > Blogs > SQL Server > How to Get SSMS to Recognize an Existing Object (Refreshing Lists in SSMS)

How to Get SSMS to Recognize an Existing Object (Refreshing Lists in SSMS)

Like This Blog 0 Peter Avila
Added by August 8, 2013

Ever get this message in SQL Server Management Studio (SSMS) when you’re certain that the object exists?

SQL Server Management Studio SSMS

Then it proves you right when you go ahead and execute the command anyway?

002-SQL-Server-Management-Studio-SSMS-existing-object

Why does SSMS complain that the object doesn’t exist when it obviously does?

This happens because SSMS does not monitor database changes made in the query window. Let’s look at an example. Let’s say you create a table using the SSMS tools—in this case, the menu that comes up when you right-click the Tables folder in SSMS Object Explorer.

SSMS Explorer SQL Server Management Studio SSMS

Because you asked SSMS to create the table, it is aware of the new object, and it refreshes its caches automatically to include it. So, after you save the new table, you see it listed in the Tables folder, …

SSMS Tables Folder

… you see it in Intellisense, …

Intellisence SQL Server Management Studio SSMS

… and SSMS doesn’t complain about it with a “red squiggly” as it did in the very first figure of this post.

006-Intellisence-SSMS-SQL-Server-Management-Studio-existing-object

But now let’s say you create a table using a SQL CREATE TABLE command in a query window.

SQL CREAT TABLE SSMS

SSMS doesn’t monitor changes made to the database by SQL commands, so, even though the command completed successfully and the new table now exists in the database, SSMS is not aware of it, and so it doesn’t refresh its caches and the new table doesn’t appear in the Tables folder, …

Cache not refresshing in SQL Server SSMS

… it doesn’t appear in Intellisense, …

009-cache-not-refreshed-intellisence-SQL-Server-Management-Studio-SSMS-existing-object

… and SSMS will use a red squiggly to complain about it if you reference it in a query window, just like it did in the very first figure of this post.

What to do?

Fortunately, it’s very easy to ask SSMS to update its caches. To update a folder cache, you can right-click the folder in Object Explorer and select Refresh (btw, you can also refresh individual folders, tables, columns, entire databases at once, and just about anything you see listed in Object Explorer).

Object Explorer and Refresh SQL Server SSMS

Another way is to select a folder or other item in Object Explorer, then use the Refresh button at the top of the Object Explorer panel to refresh the item you select. This approach has the advantage of allowing you to refresh more than one item in Object Explorer.

SSMS refresh cache button

That’s how you update the folders in SSMS. It is just as easy to update the Intellisense cache. Just select the Edit menu from any query window, then Intellisense, and then Refresh Local Cache or use the keystroke shortcut Ctrl-Shift-R.

012-Refresh-Local-Cache-SQL-Server-Management-Studio-SSMS-existing-object

Enjoy!
Peter Avila
SQL Server Instructor – Interface Technical Training
Phoenix, AZ

Videos You May Like

Agile Methodology in Project Management

0 153 0

In this video, you will gain an understanding of Agile and Scrum Master Certification terminologies and concepts to help you make better decisions in your Project Management capabilities. Whether you’re a developer looking to obtain an Agile or Scrum Master Certification, or you’re a Project Manager/Product Owner who is attempting to get your product or … Continue reading Agile Methodology in Project Management

Creating Users and Managing Passwords in Microsoft Office 365

0 642 3

In this Office 365 training video, instructor Spike Xavier demonstrates how to create users and manage passwords in Office 365.   For instructor-led Office 365 training classes, see our course schedulle: Spike Xavier SharePoint Instructor – Interface Technical Training Phoenix, AZ 20347: Enabling and Managing Office 365    

Detailed Forensic Investigation of Malware Infections – April 21, 2015

4 608 5

How does an investigator hunt down and identify unknown malware? In this recording of our IT Security training webinar on April 21, 2015, Security expert Mike Danseglio (CISSP / CEH) performed several malware investigations on infected computers and identify symptoms, find root cause, and follow the leads to determine what’s happening. He demonstrated his preferred … Continue reading Detailed Forensic Investigation of Malware Infections – April 21, 2015

Write a Comment

Share your thoughts...

Please fill out the comment form below to post a reply.