/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BCM_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_BCM_CONVERDIFFTEMPLATE', 'T_BCM_CONVERDIFFTEMPLATE', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_INVCHANGEACCTSETTING', 'T_BCM_INVCHANGEACCTSETTING', 'FID', '1';

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




 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_INVCHANGEENTRY') CREATE INDEX IDX_BCM_INVCHANGEENTRY ON T_BCM_INVCHANGEENTRY ( FMODELID ,FINVESTEECOMPANYID );


 EXEC P_ALTERPK 'PK_T_BCM_INVCHANGEENTRY_L', 'T_BCM_INVCHANGEENTRY_L', 'FPKID', '1';

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




 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_INVCHANGESTATUS_MSYP') CREATE INDEX IDX_BCM_INVCHANGESTATUS_MSYP ON T_BCM_INVCHANGESTATUS ( FMODELID ,FSCENARIOID ,FFYID ,FPERIODID );


 EXEC P_ALTERPK 'PK_T_BCM_INVELIMTEMPLATE_L', 'T_BCM_INVELIMTEMPLATE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_INVRELATION', 'T_BCM_INVRELATION', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_INVSHARERELA_L', 'T_BCM_INVSHARERELA_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_CONDIFFMEMBRANGE', 'T_BCM_CONDIFFMEMBRANGE', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_CONVERTDIFFENTITY', 'T_BCM_CONVERTDIFFENTITY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_CONVERTDIFF_MODEL') CREATE INDEX IDX_BCM_CONVERTDIFF_MODEL ON T_BCM_CONVERTDIFFENTITY ( FMODELID ,FSCENARIOID );




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


 EXEC P_ALTERPK 'PK_T_BCM_INVSHARERELA', 'T_BCM_INVSHARERELA', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_INVSHARERELA_MORG') CREATE INDEX IDX_BCM_INVSHARERELA_MORG ON T_BCM_INVSHARERELA ( FMODELID ,FSHAREHOLDERID ,FINVESTEECOMPANYID );


 EXEC P_ALTERPK 'PK_T_BCM_CARRYENTITY', 'T_BCM_CARRYENTITY', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_BCM_INVELIMTEMPLATEENTRY', 'T_BCM_INVELIMTEMPLATEENTRY', 'FENTRYID', '1';

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



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