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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_ARC_FENTITYID') CREATE INDEX IDX_AR_ARC_FENTITYID ON T_AR_ACCRRESERVECONFIG ( FENTITYID );


 EXEC P_ALTERPK 'PK_T_AR_ACCRUALFACTOR', 'T_AR_ACCRUALFACTOR', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_AR_ACCRUALFACTOR_L', 'T_AR_ACCRUALFACTOR_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_AR_ACCRUALFACTOR_ENTRY', 'T_AR_ACCRUALFACTOR_ENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_AR_ACCRUALSCHM_IND', 'T_AR_ACCRUALSCHM_IND', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_AR_ACCRUALSCHM_IND_L', 'T_AR_ACCRUALSCHM_IND_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_AR_ACCRUALSCHM_INDENTRY', 'T_AR_ACCRUALSCHM_INDENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_AR_ACCRUALSOURCE', 'T_AR_ACCRUALSOURCE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_AR_ACCRUALSOURCE_L', 'T_AR_ACCRUALSOURCE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_AR_MULACCRUALSOURCE', 'T_AR_MULACCRUALSOURCE', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_AR_MULACCRUALSOURCE_IND', 'T_AR_MULACCRUALSOURCE_IND', 'FPKID', '1';

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



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