由于视图不是架构绑定错误,因此无法在视图上创建索引1939 [英] Cannot create index on view because the view is not schema bound error 1939

查看:224
本文介绍了由于视图不是架构绑定错误,因此无法在视图上创建索引1939的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理的作业的第三部分说,基于OrderID和EmployeeID列创建并索引现有的Northwind视图,称为"dbo.Orders Qry"."

The third part of this assignment I'm working on says, "Create and index the existing Northwind view called "dbo.Orders Qry" based on the columns OrderID and EmployeeID."

预计我会得到一个错误;但是,我的教练只是告诉我们Google.我这样做了,但是方案绑定甚至在本周的课程或任何其他课程中都没有,而且我发现的内容太深了,我无法理解.

It is expected that I will get an error; however, my instructor only told us to Google it. I did, but scheme binding isn't even in this week's lesson or any others, and the things I've found are too in-depth for me to understand.

这是我不选中复选框或在某处更改设置的问题吗?

Is this an issue of me not checking a box or changing a setting somewhere?

推荐答案

类似的声音描述了索引视图,您可以在Microsoft网站

Sounds like this is describing an indexed view, you can read up on them at Microsoft's site here. Microsoft enabled this capability starting with SQL 2005.

在视图定义的文本中,您需要在CREATE VIEW语句之后添加词WITH SCHEMABINDING,例如:

In the text for the view definition, you'd need to add the words WITH SCHEMABINDING just after the CREATE VIEW statement, for example:

CREATE VIEW dbo.MyView
WITH SCHEMABINDING

AS

SELECT a, b, c
FROM dbo.MyTable

要添加索引,您需要在视图定义中添加类似于以下内容的语句:

To add indexing, you'd add a statement to the view definition similar to this:

-- Create an index on the view.
CREATE UNIQUE CLUSTERED INDEX IDX_MyView_ClusteredIndex
ON dbo.MyView(a, b, c)

GO

这篇关于由于视图不是架构绑定错误,因此无法在视图上创建索引1939的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆