开发者

View is not schema bound?

I have a select query to retrieve data from tables. It is working fine, but when there's a condition to select some 3 values, it is not giving a result. Error message;

Query processor ran out of Internal resource开发者_如何学编程s

I looked through INDEX seems to work fine, then I created view with that select statement, but couldn't create an index. Error message;

View is not schema bound


In order to create an indexed view the view needs to be schema bound to the entities that it is a view over.

To make a view schema bound, simply specify simply use WITH SCHEMABINDING in the view CREATE / UPDATE query, for example:

CREATE VIEW MyView
WITH SCHEMABINDING 
AS
-- SELECT

See this link for more information on schema binding, or the MSDN page on the CREATE VIEW statement.

However from what you have said I don't think the indexed view will necessarily help you - the message "Query processor ran out of Internal resources" means that the query processor failed to produce an execution plan for your query, which I would guess only happens with extremely complex queries.

You should try to reduce the complexity of your query somehow.


I would guess that you are trying to create the index on the view instead of the underlying tables. if you truly need to index the view it must meet these criteria:

http://technet.microsoft.com/en-us/library/cc917715.aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜