While I was working with one of my DBA friends, we got into a topic wherein the SSMS was giving the “invalid object name” error even though the instance was correctly selected. Suddenly, the fix just ran into my mind. The error related to the database context can be due to the unrefreshed IntelliSense Cache. The IntelliSense Cache is not automatically refreshed in SQL Server. It is important to refresh the IntelliSense Cache manually.
The red underline of the database object
that you have created may sometime freak you though you are connected to the
correct database. This confusion is illustrated in a simple manner with a
simple fix to clear the IntelliSense Cache.
Demonstration of a similar situation of the red line
on the object names.
Step 1: Created a table as “Day” in one of
my databases
Step 2: Dropped the table “Day”
Step 3: Trying to re-create the table with
same name as “Day”.
From the image, if you note that the object
name shows a red underline with the tag as the object name already exists. This
is purely the issue related to the IntelliSense Cache.
To check IntelliSense Cache enabled or not in
your SSMS.
Step 1: Click on “Query” option from Top
Taskbar.
Step 2: Check if the “IntelliSense Enable” option is highlighted as shown in the image. If the option is highlighted, which means the feature is enabled.
Let’s check how to refresh the IntelliSense Cache manually.
FIX 1: Through keyboard commands
Simply press Ctrl + Shift + R on your keyboard
FIX 2: Through GUI
From top menus bar, click on “Edit” à “IntelliSense” à “Refresh Local Cache”
0 comments:
Post a Comment