如何查找哪些索引是只读文件组?

时间:2014-10-21 07:59:58

标签: sql-server

如何找到read-only filegroup中的哪些索引?当我尝试REORDERREBUILD时,我需要将其排除在外。

1 个答案:

答案 0 :(得分:0)

我自己找到了:

IF EXISTS(SELECT i.name AS FileGroup FROM sys.filegroups d 
        JOIN sys.indexes i ON i.data_space_id = d.data_space_id 
        WHERE (d.is_read_only = 1) AND (i.name LIKE ' ... index name ... ')) 
    PRINT 'Do NOT REBUILD! File-Gruop is READ-ONLY';