我有一个这样创建的视图:
CREATE VIEW [dbo].[vwData] WITH SCHEMABINDING AS SELECT [DataField1] , [DataField2] , [DataField3] FROM dbo.tblData
当我尝试在其上创建全文索引时,如下所示:
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.
知道为什么吗?
您必须通过创建唯一的聚集索引来为视图建立索引:
create unique clustered index ix_vwData on vwData(<unique columns>)
之后,索引idx_DataField必须是唯一的,不可为空的单列索引。
idx_DataField