USP_DROPALLCOLUMNSTOREINDEXES
Definition
Copy
CREATE procedure [BBDW].[USP_DROPALLCOLUMNSTOREINDEXES] as
declare @SCHEMA nvarchar(255);
declare @TABLE nvarchar(255);
declare [TABLECURSOR] cursor local fast_forward for
--Find all clustered and non-clustered column store indexes
select
s.[name] as [SCHEMA],
t.[name] as [TABLE]
from sys.[tables] t
inner join sys.[schemas] s on s.[schema_id] = t.[schema_id]
where t.[object_id] in
(select i.[object_id] from sys.[indexes] i where i.[type] in (5, 6));
open [TABLECURSOR];
fetch next from [TABLECURSOR] into @SCHEMA, @TABLE
while(@@fetch_status <> -1)
begin
exec BBDW.[USP_DROPCOLUMNSTOREINDEX] @SCHEMA, @TABLE
fetch next from [TABLECURSOR] into @SCHEMA, @TABLE;
end
close [TABLECURSOR];
deallocate [TABLECURSOR];