views:

314

answers:

2

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.

+1  A: 

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...

gbn
A: 

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.

Vladimir Levchenko

related questions