views:

75

answers:

2

I created a view. The view's Query works fine. Now I want to write another Query which uses the first one. As far as I know it should look like this:

SELECT * FROM myView;

Now there is an Error returned: "Ungültiger Objektname 'myView'" in English its something like "unvalid object name 'myView'.

How do I refer to or call views the right way? I#M using SQL Server.

+4  A: 

Check that you created the view in the right database, right schema and granted the SELECT privilege on the view to the user that uses it.

Or, better, post the SQL you used to create the view.

Quassnoi
In addition: If this is via Management Studio, it's possible the database selected was changed. Good habit to use the three name format: http://msdn.microsoft.com/en-us/library/ms187879.aspx
OMG Ponies
Its in the right database, but it worked this style database_name.schema_name.object_name
c0d3x
A: 

That error usually means that you are looking in the wrong database or schema. If you are using management studio, sometimes the wrong database can be selected in the dropdown next to the execute button, and if you don't use the fully qualified name of the view it will try to run using the selected database.

ryanulit