CREATE_OR_DROP_FACT_INTERACTION_INDICES

Parameters

Parameter Parameter Type Mode Description
@CREATE_OR_DROP bit IN

Definition

Copy

create procedure [BBDW].[CREATE_OR_DROP_FACT_INTERACTION_INDICES]
  @CREATE_OR_DROP bit --1 to create, 0 to drop.
  as
  set nocount on;

  if @CREATE_OR_DROP is null
  raiserror('@CREATE_OR_DROP must be 1 or 0 in [BBDW].[CREATE_OR_DROP_FACT_INTERACTION_INDICES]',16,10);

  if @CREATE_OR_DROP =1
  begin
  --create

    if  [BBDW].[UFN_INDEXEXISTS]('IX_FACT_INTERACTION_ORDER') = 0
      create nonclustered index [IX_FACT_INTERACTION_ORDER] on [BBDW].[FACT_INTERACTION] ([INTERACTIONDATE] ,[INTERACTIONSEQUENCE]) with (DATA_COMPRESSION = PAGE) on [BBRPT_FACTIDXGROUP];

  end
  else
  begin
  --drop

    if  [BBDW].[UFN_INDEXEXISTS]('IX_FACT_INTERACTION_ORDER') = 1
     drop index [IX_FACT_INTERACTION_ORDER] on [BBDW].[FACT_INTERACTION]; 

  end