/**Begin D:\DBA\1.4\PDM_UPGRADE\PDM1\BCM_constraint.sql **/
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_ISGROUPMAP' AND KSQL_INDNAME = 'IDX_BCM_ISGROUPMAP_SCH') CREATE INDEX IDX_BCM_ISGROUPMAP_SCH ON T_BCM_ISGROUPMAP ( FSCHEMEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_ERRORLOG' AND KSQL_INDNAME = 'IDX_BCM_ERRORLOG_MODELID') CREATE INDEX IDX_BCM_ERRORLOG_MODELID ON T_BCM_ERRORLOG ( FMODELID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_TEMPLATE' AND KSQL_INDNAME = 'IDX_BCM_TEMPLATE_GROUP') CREATE INDEX IDX_BCM_TEMPLATE_GROUP ON T_BCM_TEMPLATE ( FGROUP ,FSTATUS );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_RPTADJUSTDATA' AND KSQL_INDNAME = 'IDX_BCM_RPTADJUSTDATA_ACCTID') CREATE INDEX IDX_BCM_RPTADJUSTDATA_ACCTID ON T_BCM_RPTADJUSTDATA ( FACCOUNTID );

EXEC p_DropIdx 'IDX_BCM_INVRELATION', 'T_BCM_INVRELATION';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_INVRELATION' AND KSQL_INDNAME = 'IDX_BCM_INVRELATION') CREATE INDEX IDX_BCM_INVRELATION ON T_BCM_INVRELATION ( FMODELID ,FSCENARIOID ,FFYID ,FPERIODID ,FORGUNITID );

EXEC p_DropIdx 'IDX_BCM_ICENTITY_DIM', 'T_BCM_STRUCTOFICENTITY';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BCM_STRUCTOFICENTITY' AND KSQL_INDNAME = 'IDX_BCM_ICENTITY_DIM') CREATE INDEX IDX_BCM_ICENTITY_DIM ON T_BCM_STRUCTOFICENTITY ( FDIMENSIONID ,FASSOSTOREMEMID );


/**End D:\DBA\1.4\PDM_UPGRADE\PDM1\BCM_constraint.sql **/
