Wednesday 20 September 2017

How to Enable or Disable Index on Table using SQL

Index Status: 
select 
    sys.objects.name, 
    sys.indexes.name 
from sys.indexes 
    inner join sys.objects on sys.objects.object_id = sys.indexes.object_id 
where sys.indexes.is_disabled = 1 
order by 
    sys.objects.name, 
    Sys.indexes.name 
----------------------------------------------------------------------------------- 
Index Disable: 

use DB 
go 
ALTER INDEX Index_name ON Table_name 
DISABLE; 
-------------------------------------------------------------------------------- 
Index Enable: 

use ACTIVEQUOTE 
go 
ALTER INDEX Index_name ON Table_name 
rebuild

No comments:

Post a Comment

How to find table row count?

--Use below query to find table row count select so.name,sp.rows from sys.objects so inner join sys.partitions sp on so.object_id = sp.obj...