开发者

Howto call views inside another SELECT statement (SQL Server)?

I created a view. The view's Query works fine. No开发者_如何学编程w 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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜