/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\CAS_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_CAS_AUTOMATCHRESULT', 'T_CAS_AUTOMATCHRESULT', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_CAS_AUTOMATCHRESULT') CREATE UNIQUE  CLUSTERED INDEX IDX_CAS_AUTOMATCHRESULT ON T_CAS_AUTOMATCHRESULT ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_CAS_AUTOMATCHRESULT_E', 'T_CAS_AUTOMATCHRESULT_E', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_CAS_SMARTMATCH', 'T_CAS_SMARTMATCH', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_CAS_SMCH_FNUMBER') CREATE UNIQUE  CLUSTERED INDEX IDX_CAS_SMCH_FNUMBER ON T_CAS_SMARTMATCH ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_CAS_SMARTMATCH_E', 'T_CAS_SMARTMATCH_E', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_CAS_AUTOMATCHRESULT_L', 'T_CAS_AUTOMATCHRESULT_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_CAS_SMARTMATCH_L', 'T_CAS_SMARTMATCH_L', 'FPKID', '1';

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



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