在视图上创建全文索引的问题 [英] Problems creating a full text index on a view

查看:36
本文介绍了在视图上创建全文索引的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样创建的视图:

I have a view which has been created like this:

CREATE VIEW [dbo].[vwData] WITH SCHEMABINDING
AS
    SELECT  [DataField1] ,
            [DataField2] ,
            [DataField3]
    FROM    dbo.tblData

当我尝试在其上创建全文索引时,如下所示:

When I try to create a full text index on it, like this:

CREATE FULLTEXT INDEX ON [dbo].[vwData](
[DataField] LANGUAGE [English])
KEY INDEX [idx_DataField]ON ([ft_cat_Server], FILEGROUP [PRIMARY])
WITH (CHANGE_TRACKING = AUTO, STOPLIST = SYSTEM)

我收到此错误:

View 'dbo.vwData' is not an indexed view. 
Full-text index is not allowed to be created on it.

知道为什么吗?

推荐答案

你必须通过创建唯一聚集索引来索引你的视图:

you have to make your view indexed by creating unique clustered index:

create unique clustered index ix_vwData on vwData(<unique columns>)

之后,索引 idx_DataField 必须是唯一的、不可为空的单列索引.

After that, index idx_DataField must be a unique, non-nullable, single-column index.

这篇关于在视图上创建全文索引的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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