Lieven Cardoen
Lieven Cardoen

Reputation: 25959

SQL Server 2008 Management Studio doesn't recognize new Schema

I have created a new Schema in a database called Contexts. Now when I want to write a query, Management Studio doesn't recognize the tables that belong to the new Schema. It says: 'Invalid object name Contexts.ContextLibraries'...

Transact-SQL:

INSERT INTO [Contexts].[ContextLibraries] (ChannelId, [IsSystem])
VALUES (@ChannelId, 1)

When I try the same thing on my local database, it does work...

Any ideas?

I did try to change the Default schema for the user from dbo to Contexts but this doesn't work. Also checked Contexts in Schemas owned by this user without success.

Update: Apparently the sql query does work but the editor gives a fault saying the object is invalid.

Upvotes: 0

Views: 2590

Answers (2)

Vladimir Levchenko
Vladimir Levchenko

Reputation: 71

Try to refresh local cache of Management Studio:

Management Studio Menu >> Edit >> IntelliSense >> Refresh Local Cache

or use shortcut:

CTRL + SHIFT + R

I always forget that it's there.

Upvotes: 7

gbn
gbn

Reputation: 432271

You may need to refresh SSMS: if raw SQL works.

Frankly, the easiest way is to close object explorer on the server and re-open. The SQL Server client tools have a problem with caching back into the Jurassic period...

Upvotes: 1

Related Questions