如何查找SQL全文索引使用的唯一表索引

时间:2009-07-30 16:58:35

标签: sql-server-2005

如何发现全文索引引用的唯一表索引的名称?用于生成响应的SQL将是最有用的,但GUI(SSMS)解决方案也将起作用。

1 个答案:

答案 0 :(得分:3)

此查询应该执行此操作 - 适用于SQL Server 2005及更高版本:

SELECT 
    OBJECT_NAME(fti.object_id) AS 'Table Name',
    i.name AS 'Index Name',
    c.name AS 'Column Name'
FROM 
    sys.fulltext_indexes fti
INNER JOIN 
    sys.index_columns ic ON ic.object_id = fti.object_id AND ic.index_id = fti.unique_index_id
INNER JOIN 
    sys.columns c ON c.object_id = ic.object_id AND c.column_id = ic.column_id
INNER JOIN
    sys.indexes i ON fti.unique_index_id = i.index_id AND fti.object_id = i.object_id

马克