59

So if I create a new table in the query editor in SQL Management Studio after hitting refresh on the DB I can see and work with that table. However if I want to run another query referencign that table from withen the query editor it doesn't reconize that table exists. I've tried hitting refresh at the DB level, and the table level but it makes no difference. However if I quit the management studio then reopen it shows up fine.

USE [DataBaseName]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[States](
    [StateAbbreviation] [nchar](2) NOT NULL,
    [StateFullName] [nchar](30) NULL,
GO

So I run that and then run this.

INSERT INTO States
SELECT *
FROM ExistingStatesTable

This fails saying that States doesn't exist. Also States doesn't show up in the intelisense. What should I do to

Dylan Corriveau
  • 2,561
  • 4
  • 29
  • 36
jamone
  • 17,253
  • 17
  • 63
  • 98

4 Answers4

205

Press Ctrl-Shift-R to refresh the intellisense.

16

If you prefer, you can use the menu to refresh the cache:

Edit>Intellisense>Refresh Local Cache

The good thing using the menu, is that you will learn some new Intellisense hot-keys...

SQL Server Management Studio Intellisense doesn’t work after schema changes

Roberto
  • 645
  • 1
  • 8
  • 16
6

You probably did what I always do. I often create a table while connected to the wrong database, or the default database. For me, the default database is 'master' so I have a lot of garbage in my master DB :)

Randy Minder
  • 47,200
  • 49
  • 204
  • 358
  • or the wrong server, I've done that a tiem or two as well, created the database on one server ran the query on another. – HLGEM Feb 04 '10 at 16:14
  • No I can refresh the object browser on the left and it shows the table in the right DB – jamone Feb 04 '10 at 16:16
0

I right-click on the Tables and Select Refresh from the context-sensitive menu (Ctrl-R works too)

Terry
  • 21
  • 1
  • 4
  • "Refresh" from the menu doesn't work for me regardless where I right-click in the object tree (v18.9.2). – FloverOwe Feb 02 '23 at 00:50