/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\kd_1.5.1_bcm_constraint_190723.sql **/
 EXEC P_ALTERPK 'PK_T_BCM_METRICMEMBER', 'T_BCM_METRICMEMBER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_METRIC_MEM_NUM') CREATE INDEX IDX_BCM_METRIC_MEM_NUM ON T_BCM_METRICMEMBER ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_BCM_STRUCTOFMETRIC', 'T_BCM_STRUCTOFMETRIC', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_METRIC_NUMBER') CREATE INDEX IDX_BCM_METRIC_NUMBER ON T_BCM_STRUCTOFMETRIC ( FNUMBER );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_METRIC_LONGNUM') CREATE INDEX IDX_BCM_METRIC_LONGNUM ON T_BCM_STRUCTOFMETRIC ( FLONGNUMBER );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_METRIC_DIM') CREATE INDEX IDX_BCM_METRIC_DIM ON T_BCM_STRUCTOFMETRIC ( FDIMENSIONID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_METRIC_PARENT') CREATE INDEX IDX_BCM_METRIC_PARENT ON T_BCM_STRUCTOFMETRIC ( FPARENTID );


 EXEC P_ALTERPK 'PK_T_BCM_STRUCTOFMETRIC_L', 'T_BCM_STRUCTOFMETRIC_L', 'FPKID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_METRIC_L_NAME') CREATE INDEX IDX_BCM_METRIC_L_NAME ON T_BCM_STRUCTOFMETRIC_L ( FNAME );


 EXEC P_ALTERPK 'PK_T_BCM_METRICMEMBER_L', 'T_BCM_METRICMEMBER_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BCM_EB_METRIC_L') CREATE INDEX IDX_BCM_EB_METRIC_L ON T_BCM_METRICMEMBER_L ( FID );
 /**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\kd_1.5.1_bcm_constraint_190723.sql **/