Hello and welcome to Excel Jet Consult blog post. In this blog post, we are going to look at how to handle cache in SSMS to keep your SQL Query sharp. Le’ts get started.
IntelliSense is a handy feature in SQL Server Management Studio (SSMS) that helps users to write SQL code more efficiently by providing auto-completion suggestions and syntax checking. However, like any software, it can sometimes have problems with its internal memory, or “cache.”
In SSMS, when IntelliSense starts acting up, like not suggesting the right table or column names or showing red underlines on correct code, it’s often due to this cached information being outdated or incorrect.
To fix this, SSMS provides a way to refresh or update IntelliSense’s memory. You can do this by:
- Pressing Ctrl + Shift + R: This keyboard shortcut is a quick way to force IntelliSense to refresh and get the latest information from the database.
- Going to Edit > IntelliSense > Refresh Local Cache: This is a menu option to achieve the same result. By selecting it, you’re telling SSMS to clear out the old cached information and get fresh data
After performing one of above actions, IntelliSense should have an up-to-date understanding of your database, and you should see more accurate suggestions and fewer red underlines.
Use Case Example
In the screenshot below, we’ve got a query to simply return TransactionDate and Revenue from MonthlySales table. However, it is observed that the names of the columns are underlined with red color which potentially implies invalid column names. When the query was executed, the rows in the table was returned which means, the query is fine but the cache intelliSense needs to be refreshed.
- To refresh, I am going to press CTRL + SHIFT + R keyboard shortcut.
From the screenshot below, we can see that the red underlines are gone.
See you in the next tutorial