是否可以使用 SQL Server 2008 创建一个从另一个索引视图中进行选择的索引视图?

发布于 2024-07-25 05:45:55 字数 167 浏览 3 评论 0原文

是否可以使用 SQL Server 2008 创建一个从另一个索引视图中进行选择的索引视图?

create view V1 as (select 1 as abc)
create view V2 as (select abc from V1 group by abc)

Is it possible to create an indexed view with SQL Server 2008 which selects from another indexed view?

create view V1 as (select 1 as abc)
create view V2 as (select abc from V1 group by abc)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一抹苦笑 2024-08-01 05:45:55

以下是索引视图的要求(它们很丰富)

  • :视图必须仅引用同一数据库中的基表,而不能引用其他视图。

Here are the requirements for indexed views (they are plentiful):

  • The view must reference only base tables in the same database, not other views.
念三年u 2024-08-01 05:45:55

我认为答案是“不,这是不可能的”。

来自 Microsoft TechNet 站点的一篇有关性能的文章:

Q。 我有一个定义在另一个视图之上的视图。 SQL Server 不允许我对顶级视图建立索引。 我能做些什么?

A。 考虑手动将嵌套视图的定义扩展到顶级视图中,然后对其建立索引、对最内层视图建立索引或不对视图建立索引。

祝你好运。

I think the answer is "no, it is not possible".

From Microsoft TechNet Site, in an article about performance:

Q. I have a view defined on top of another view. SQL Server won't let me index the top-level view. What can I do?

A. Consider expanding the definition of the nested view by hand into the top-level view, and then indexing it, indexing the innermost view, or not indexing the view.

Good Luck.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文