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

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


 EXEC P_ALTERPK 'PK_T_CAS_AUTOCALRESULT_L', 'T_CAS_AUTOCALRESULT_L', 'FPKID', '1';

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


 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_CAS_RECE_STATUSORGID') CREATE INDEX IDX_CAS_RECE_STATUSORGID ON T_CAS_RECEIVINGBILL ( FBILLSTATUS ,FORGID );


 EXEC P_ALTERPK 'PK_T_CAS_AUTOCALRESULT_E', 'T_CAS_AUTOCALRESULT_E', 'FENTRYID', '1';

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



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