/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\LCS_constraint.sql **/
 EXEC P_ALTERPK 'PK_LCS_COSTDIMENSION', 'T_LCS_COSTDIMENSION', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_LCS_COSTDIMENSION_L', 'T_LCS_COSTDIMENSION_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_LCS_COSTDIMENSION_L') CREATE INDEX IDX_LCS_COSTDIMENSION_L ON T_LCS_COSTDIMENSION_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_LCS_COSTSTRU', 'T_LCS_COSTSTRU', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_LCS_COSTSTRU_L', 'T_LCS_COSTSTRU_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_LCS_COSTSTRU_L') CREATE INDEX IDX_LCS_COSTSTRU_L ON T_LCS_COSTSTRU_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_LCS_COSTSTRUENTRY', 'T_LCS_COSTSTRUENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_LCS_COSTSTRUENTRY') CREATE INDEX IDX_LCS_COSTSTRUENTRY ON T_LCS_COSTSTRUENTRY ( FCOSTDIMENSIONID );


 EXEC P_ALTERPK 'PK_LCS_COSTSTRUENTRY_L', 'T_LCS_COSTSTRUENTRY_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_LCS_COSTSTRUENTRY_L') CREATE INDEX IDX_LCS_COSTSTRUENTRY_L ON T_LCS_COSTSTRUENTRY_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_LCS_COSTSTRUDETAIL', 'T_LCS_COSTSTRUDETAIL', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_LCS_COSTSTRUDETAIL') CREATE INDEX IDX_LCS_COSTSTRUDETAIL ON T_LCS_COSTSTRUDETAIL ( FSEQ );


 EXEC P_ALTERPK 'PK_LCS_COSTBIZOBJ', 'T_LCS_COSTBIZOBJ', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_LCS_COSTBIZOBJ_L', 'T_LCS_COSTBIZOBJ_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_LCS_COSTBIZOBJ_L') CREATE INDEX IDX_LCS_COSTBIZOBJ_L ON T_LCS_COSTBIZOBJ_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_LCS_COSTBIZTYPE_L', 'T_LCS_COSTBIZTYPE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_LCS_COSTBIZTYPE_L') CREATE INDEX IDX_LCS_COSTBIZTYPE_L ON T_LCS_COSTBIZTYPE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_LCS_COSTBIZTYPE', 'T_LCS_COSTBIZTYPE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_LCS_COSTITEMTYPE_L', 'T_LCS_COSTITEMTYPE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_LCS_COSTITEMTYPE_L') CREATE INDEX IDX_LCS_COSTITEMTYPE_L ON T_LCS_COSTITEMTYPE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_LCS_COSTITEMTYPE', 'T_LCS_COSTITEMTYPE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_LCS_COSTITEM_L', 'T_LCS_COSTITEM_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_LCS_COSTITEM_L') CREATE INDEX IDX_LCS_COSTITEM_L ON T_LCS_COSTITEM_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_LCS_COSTITEM', 'T_LCS_COSTITEM', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_LCS_COSTITEMENTRY', 'T_LCS_COSTITEMENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_LCS_COSTITEMENTRY') CREATE INDEX IDX_LCS_COSTITEMENTRY ON T_LCS_COSTITEMENTRY ( FHRITEMID );


 EXEC P_ALTERPK 'PK_LCS_SEGEMENT', 'T_LCS_SEGEMENT', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_LCS_SEGEMENT_L', 'T_LCS_SEGEMENT_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_LCS_SEGEMENT_L') CREATE INDEX IDX_LCS_SEGEMENT_L ON T_LCS_SEGEMENT_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_LCS_COSTADAPTION', 'T_LCS_COSTADAPTION', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_LCS_COSTADAPTION_L', 'T_LCS_COSTADAPTION_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_LCS_COSTADAPTION_L') CREATE INDEX IDX_LCS_COSTADAPTION_L ON T_LCS_COSTADAPTION_L ( FID ,FLOCALEID );




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