Enable Full-Text Search on View with Inner Join

后端 未结 1 1025
有刺的猬
有刺的猬 2020-12-16 17:24

I\'m running Sql Server 2008 R2 and I need to enable Full-Text search on a view with a inner join. My problem is that I don\'t know how to create my Full-Text Index.

相关标签:
1条回答
  • 2020-12-16 18:06

    You can only create a full text index on an indexed view, that is why you are getting the error. To create full-text search on a table or view, it must have a unique, single-column, non-nullable index.

    In other words, you should create your view something like this:

    CREATE VIEW ViewSearch WITH SCHEMABINDING AS
    SELECT Persons.P_Id AS ID, Persons.LastName, Persons.FirstName, Orders.OrderNo
        FROM Persons
        INNER JOIN Orders ON Persons.P_Id=Orders.P_Id
    GO
    CREATE UNIQUE CLUSTERED INDEX IX_ViewSearch ON ViewSearch (ID)
    

    SQL full-text search builds a full-text index through a process called population, which fills the index with words and the locations in which they occur in your tables and rows. That is why you need a field that will uniquely identify you each row and that is why you need to make the view indexed.

    More information here.

    0 讨论(0)
提交回复
热议问题