sqlsql-servert-sqlsql-server-2012full-text-indexing

Problems creating a full text index on a view


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)

I get this error:

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

Any idea why?


Solution

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

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

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