"Invalid Object Name" Error in SSMS for recently created objects

Updated: Jan 4

Suppose you created a new table in SQL Server or Azure SQL Database in SQL Server Management Studio, and the query editor shows you the error message "Invalid Object Name" as shown below.


You verified that table exists in the database, and if you run any query for that table, it works fine. Then, why is SSMS generating an error – Invalid Object Name.


One way to get rid of this message is to restart SSMS, but do you want to do that? No, right! The SQL Server Management Studio uses IntelliSense to identify an object's existence. The SSMS maintains a local cache for the objects, and if you create a new object, the local cache does not have information about the object. That's why you get such a message, and the object is highlighted with a red underline.


How do we Refresh Local Cache in SQL Server Management Studio?


In the SSMS, navigate to Edit --> IntelliSense --> Refresh Local Cache.


Or use the shortcut CTRL + SHIFT+ R for refreshing the local cache for IntelliSense. It immediately refreshes cache and does not see the Invalid Object Name error, as shown below.



47 views0 comments