1

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.

1

2 Answers 2

4

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.

2
  • In addition: If this is via Management Studio, it's possible the database selected was changed. Good habit to use the three name format: msdn.microsoft.com/en-us/library/ms187879.aspx
    – OMG Ponies
    Commented Jan 13, 2010 at 18:35
  • Its in the right database, but it worked this style database_name.schema_name.object_name
    – c0d3x
    Commented Jan 14, 2010 at 10:17
0

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.