views:

147

answers:

3

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

+1  A: 

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

Randy Minder
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
No I can refresh the object browser on the left and it shows the table in the right DB
jamone
+4  A: 

Press Ctrl-Shift-R to refresh the intellisense.

DyingCactus
A: 

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

Terry