/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\AR_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_AR_REV_VERIFYRECORD', 'T_AR_REV_VERIFYRECORD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AR_REV_VERIFYRECORD' AND KSQL_INDNAME = 'IDX_AR_REV_FNUMBER') CREATE INDEX IDX_AR_REV_FNUMBER ON T_AR_REV_VERIFYRECORD ( FWFNUMBER );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AR_REV_VERIFYRECORD' AND KSQL_INDNAME = 'IDX_AR_REV_DATE_ORG') CREATE INDEX IDX_AR_REV_DATE_ORG ON T_AR_REV_VERIFYRECORD ( FCREATETIME ,FORGID );


 EXEC P_ALTERPK 'PK_T_AR_REV_VRRECORDENTRY', 'T_AR_REV_VRRECORDENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AR_REV_VRRECORDENTRY' AND KSQL_INDNAME = 'IDX_ARREV_MAIN_BILLNO') CREATE INDEX IDX_ARREV_MAIN_BILLNO ON T_AR_REV_VRRECORDENTRY ( FBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AR_REV_VRRECORDENTRY' AND KSQL_INDNAME = 'IDX_ARREV_MAIN_BILLENTRYID') CREATE INDEX IDX_ARREV_MAIN_BILLENTRYID ON T_AR_REV_VRRECORDENTRY ( FBILLENTRYID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AR_REV_VRRECORDENTRY' AND KSQL_INDNAME = 'IDX_ARREV_MAIN_BILLID') CREATE INDEX IDX_ARREV_MAIN_BILLID ON T_AR_REV_VRRECORDENTRY ( FBILLID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AR_REV_VRRECORDENTRY' AND KSQL_INDNAME = 'IDX_ARREV_ASST_BILLNO') CREATE INDEX IDX_ARREV_ASST_BILLNO ON T_AR_REV_VRRECORDENTRY ( FASSBILLNO );

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AR_REV_VRRECORDENTRY' AND KSQL_INDNAME = 'IDX_ARREV_ASST_BILLID') CREATE INDEX IDX_ARREV_ASST_BILLID ON T_AR_REV_VRRECORDENTRY ( FASSBILLID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AR_REV_VRRECORDENTRY' AND KSQL_INDNAME = 'IDX_ARREV_ASST_BILLIENTRYID') CREATE INDEX IDX_ARREV_ASST_BILLIENTRYID ON T_AR_REV_VRRECORDENTRY ( FASSBILLENTRYID );


 EXEC P_ALTERPK 'PK_AR_REV_VRRECORDENTRY_E', 'T_AR_REV_VRRECORDENTRY_E', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AR_REV_VRRECORDENTRY_E' AND KSQL_INDNAME = 'IDX_ARREV_REVBILLNO') CREATE INDEX IDX_ARREV_REVBILLNO ON T_AR_REV_VRRECORDENTRY_E ( FREVBILLNO );



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