/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TCTB_constraint.sql **/
 EXEC P_ALTERPK 'PK_TCTB_PARAMENUM', 'T_TCTB_PARAMENUM', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_TCTB_PARAMENUM' AND KSQL_INDNAME = 'IDX_TCTB_PARAMENUM_KEY') CREATE INDEX IDX_TCTB_PARAMENUM_KEY ON T_TCTB_PARAMENUM ( FKEY );


 EXEC P_ALTERPK 'PK_TCTB_PARAMENUM_L', 'T_TCTB_PARAMENUM_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_TCTB_PARAMENUM_L' AND KSQL_INDNAME = 'IDX_TCTB_PARAMENUM_L_0') CREATE INDEX IDX_TCTB_PARAMENUM_L_0 ON T_TCTB_PARAMENUM_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_TCTB_PARAMPLAN', 'T_TCTB_PARAMPLAN', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_TCTB_PARAMPLAN' AND KSQL_INDNAME = 'IDX_TCTB_PARAMPLAN_NO') CREATE INDEX IDX_TCTB_PARAMPLAN_NO ON T_TCTB_PARAMPLAN ( FNUMBER );


 EXEC P_ALTERPK 'PK_TCTB_PARAMPLAN_L', 'T_TCTB_PARAMPLAN_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_TCTB_PARAMPLAN_L' AND KSQL_INDNAME = 'IDX_TCTB_PARAMPLAN_L_0') CREATE INDEX IDX_TCTB_PARAMPLAN_L_0 ON T_TCTB_PARAMPLAN_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_TCTB_PARAMPLAN_ORG', 'T_TCTB_PARAMPLAN_ORG', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_TCTB_PARAMPLAN_ORG' AND KSQL_INDNAME = 'IDX_TCTB_PARAMPLAN_ORG_FK') CREATE INDEX IDX_TCTB_PARAMPLAN_ORG_FK ON T_TCTB_PARAMPLAN_ORG ( FID );


 EXEC P_ALTERPK 'PK_TCTB_PARAMPLAN_PARAM', 'T_TCTB_PARAMPLAN_PARAM', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_TCTB_PARAMPLAN_PARAM' AND KSQL_INDNAME = 'IDX_TCTB_PARAMPLAN_PARAM_FK') CREATE INDEX IDX_TCTB_PARAMPLAN_PARAM_FK ON T_TCTB_PARAMPLAN_PARAM ( FID );


 EXEC P_ALTERPK 'PK_TCTB_PARAMPLAN_PARAMVAL', 'T_TCTB_PARAMPLAN_PARAMVAL', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_TCTB_PARAMPLAN_PARAMVAL_FK') CREATE INDEX IDX_TCTB_PARAMPLAN_PARAMVAL_FK ON T_TCTB_PARAMPLAN_PARAMVAL ( FENTRYID );

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