如何找到全文索引在SQL Server 2008数据库?(How to find Full-text

2019-09-01 09:39发布

你好我要寻找的查询能够使用SQL Server 2008可为此提供的任何信息或帮助,以找到一个数据库中的所有表和列全文索引受到欢迎

Answer 1:

这里是你如何让他们

SELECT 
    t.name AS TableName, 
    c.name AS FTCatalogName ,
    i.name AS UniqueIdxName,
    cl.name AS ColumnName
FROM 
    sys.tables t 
INNER JOIN 
    sys.fulltext_indexes fi 
ON 
    t.[object_id] = fi.[object_id] 
INNER JOIN 
    sys.fulltext_index_columns ic
ON 
    ic.[object_id] = t.[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];


Answer 2:

select distinct
    object_name(fic.[object_id])as table_name,
    [name]
from
    sys.fulltext_index_columns fic
    inner join sys.columns c
        on c.[object_id] = fic.[object_id]
        and c.[column_id] = fic.[column_id]


Answer 3:

我知道这是一个古老的线程,但我现在需要这个答案,发现上面有用萨德拉Abedinzadeh的答案,但稍微缺乏对我的需要,所以我想我会张贴在这里另外一个答案,这是萨德拉的回答修改, 包括与全文索引索引视图和一些额外的列信息:

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];


文章来源: How to find Full-text indexing on database in SQL Server 2008?