如果我只知道[Web].[dbo].[Body]这个表名如何根据这个表名 找出它所有索引,并对所有索引进行重建

解决方案 »

  1.   


    select b.name,a.name 
    from sysindexes a
    inner join sysobjects b on a.id=b.id
    where b.xtype='U' and b.name='表名'找到后删除重建即可
      

  2.   

    <p>SP_help ‘[web].[dbo].[body]’ 就可以看到这个表的所有索引。</p><p>或者用</p><p>select index_id,name,type, type_desc from web.sys.indexes <br />where OBJECT_ID=object_id('body') and index_id
      

  3.   

    2013/9/23 14:24:21SP_help ‘[web].[dbo].[body]’ 就可以看到这个表的所有索引。或者用select index_id,name,type, type_desc from web.sys.indexes 
    where OBJECT_ID=object_id('body') and index_id>0然后把所有索引都做一下rebuild,语法是ALTER INDEX ALL ON [web].[dbo].[body] REBUILD