/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BCM_constraint.sql **/
EXEC P_ALTERPK 'PK_T_BCM_ACCOUNTCHGRD', 'T_BCM_ACCOUNTCHGRD', 'FENTITYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_ACCOUNTCHGRD_FID') CREATE INDEX IDX_BCM_ACCOUNTCHGRD_FID ON T_BCM_ACCOUNTCHGRD ( FID );

EXEC P_ALTERPK 'PK_T_BCM_CHKALLOCATE', 'T_BCM_CHKALLOCATE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_CHKALLOCAT') CREATE INDEX IDX_BCM_CHKALLOCAT ON T_BCM_CHKALLOCATE ( FCHKSETTINGID ,FSTAGEID );


 EXEC P_ALTERPK 'PK_T_BCM_FLOWSTEP', 'T_BCM_FLOWSTEP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM__FLOWSTEP') CREATE INDEX IDX_BCM__FLOWSTEP ON T_BCM_FLOWSTEP ( FMODELID ,FSCENE );


 EXEC P_ALTERPK 'PK_T_BCM_PHASESUBMIT', 'T_BCM_PHASESUBMIT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_PHASESUBMIT') CREATE INDEX IDX_BCM_PHASESUBMIT ON T_BCM_PHASESUBMIT ( FMODELID ,FSCENARIO );


 EXEC P_ALTERPK 'PK_T_BCM_PHASESUBMITGRP', 'T_BCM_PHASESUBMITGRP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_PHASESUBMITGRP') CREATE INDEX IDX_BCM_PHASESUBMITGRP ON T_BCM_PHASESUBMITGRP ( FPHASESUBMIT );


 EXEC P_ALTERPK 'PK_T_BCM_STAGESTATUS', 'T_BCM_STAGESTATUS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_STAGESTATUS') CREATE INDEX IDX_BCM_STAGESTATUS ON T_BCM_STAGESTATUS ( FMERGECONTROL ,FSTAGE );


 EXEC P_ALTERPK 'PK_T_BCM_PERIODMANAGEENTITY', 'T_BCM_PERIODMANAGEENTITY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_PERIODMANAGEENT') CREATE INDEX IDX_BCM_PERIODMANAGEENT ON T_BCM_PERIODMANAGEENTITY ( FMODELID ,FYEARID ,FPERIODID ,FSCENARIOID ,FORGID );


 EXEC P_ALTERPK 'PK_T_BCM_APPROVALAUTHORITY', 'T_BCM_APPROVALAUTHORITY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_APPROVALAUTHORITY') CREATE INDEX IDX_BCM_APPROVALAUTHORITY ON T_BCM_APPROVALAUTHORITY ( FMODELID );


 EXEC P_ALTERPK 'PK_T_BCM_PHASESUBMIT_L', 'T_BCM_PHASESUBMIT_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_PHASESUBMIT_L') CREATE INDEX IDX_BCM_PHASESUBMIT_L ON T_BCM_PHASESUBMIT_L ( FID );


 EXEC P_ALTERPK 'PK_T_BCM_PHASESUBMITCASE', 'T_BCM_PHASESUBMITCASE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_PHASESUBMITCASE') CREATE INDEX IDX_BCM_PHASESUBMITCASE ON T_BCM_PHASESUBMITCASE ( FPHASESUBMIT ,FPHASESUBMITGRP );


 EXEC P_ALTERPK 'PK_T_BCM_PHASESUBMITGRP_L', 'T_BCM_PHASESUBMITGRP_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_PHASUBGRP_L') CREATE INDEX IDX_BCM_PHASUBGRP_L ON T_BCM_PHASESUBMITGRP_L ( FID );

/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BCM_constraint.sql **/
