How to find Full-text indexing on database in SQL Server 2008?

后端 未结 3 443
猫巷女王i
猫巷女王i 2020-12-17 09:14

Hi I am looking for a query that is able to find Full text indexing on all tables and columns within a database using SQL Server 2008. Any information or help that can be pr

3条回答
  •  失恋的感觉
    2020-12-17 10:00

    I know this is an old thread, but I just now needed this answer, and found Sadra Abedinzadeh's answer above useful, but a slightly lacking for my needs, so I thought I'd post another answer here, which is a modification of Sadra's answer, to include Indexed Views with FullText Indexes, and some extra column information:

    use MyDatabaseName -- Modify here, of course
    
    SELECT 
        tblOrVw.[name] AS TableOrViewName,
        tblOrVw.[type_desc] AS TypeDesc,
        tblOrVw.[stoplist_id] AS StopListID,
        c.name AS FTCatalogName ,
        cl.name AS ColumnName,
        i.name AS UniqueIdxName
    FROM
    (
        SELECT TOP (1000) 
            idxs.[object_id],
            idxs.[stoplist_id],
            tbls.[name],
            tbls.[type_desc]
          FROM sys.fulltext_indexes idxs
          INNER JOIN sys.tables tbls
          on tbls.[object_id] = idxs.[object_id]
        union all 
        SELECT TOP (1000) 
            idxs.[object_id],
            idxs.[stoplist_id],
            tbls.[name],
            tbls.[type_desc]
          FROM sys.fulltext_indexes idxs
          INNER JOIN sys.views tbls -- 'tbls' reused here to mean 'views'
          on tbls.[object_id] = idxs.[object_id]
    ) tblOrVw 
    INNER JOIN sys.fulltext_indexes fi 
    on tblOrVw.[object_id] = fi.[object_id] 
    INNER JOIN 
        sys.fulltext_index_columns ic
    ON 
        ic.[object_id] = tblOrVw.[object_id]
    INNER JOIN
        sys.columns cl
    ON 
            ic.column_id = cl.column_id
        AND ic.[object_id] = cl.[object_id]
    INNER JOIN 
        sys.fulltext_catalogs c 
    ON 
        fi.fulltext_catalog_id = c.fulltext_catalog_id
    INNER JOIN 
        sys.indexes i
    ON 
            fi.unique_index_id = i.index_id
        AND fi.[object_id] = i.[object_id];
    

提交回复
热议问题