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

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


 EXEC P_ALTERPK 'PK_T_AR_RPASCHEME_L', 'T_AR_RPASCHEME_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_AR_RPASCHEMEORGENTRY', 'T_AR_RPASCHEMEORGENTRY', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_RPASO_ORG') CREATE INDEX IDX_AR_RPASO_ORG ON T_AR_RPASCHEMEORGENTRY ( FORGID );


 EXEC P_ALTERPK 'PK_T_AR_RPASCHERULEENTRY', 'T_AR_RPASCHERULEENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_AR_SETTLEIMPORT', 'T_AR_SETTLEIMPORT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_SI_DATEORG') CREATE INDEX IDX_AR_SI_DATEORG ON T_AR_SETTLEIMPORT ( FBIZDATE ,FORGID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_SI_BILLNO') CREATE INDEX IDX_AR_SI_BILLNO ON T_AR_SETTLEIMPORT ( FBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_SI_MAINBILLID') CREATE INDEX IDX_AR_SI_MAINBILLID ON T_AR_SETTLEIMPORT ( FMAINBILLID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_SI_BILLNUM') CREATE INDEX IDX_AR_SI_BILLNUM ON T_AR_SETTLEIMPORT ( FMAINBILLNUM );


 EXEC P_ALTERPK 'PK_T_AR_SETTLEIMPORTENTRY', 'T_AR_SETTLEIMPORTENTRY', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_SIE_BILLNUM') CREATE INDEX IDX_AR_SIE_BILLNUM ON T_AR_SETTLEIMPORTENTRY ( FBILLNUM );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_SIE_BILLID') CREATE INDEX IDX_AR_SIE_BILLID ON T_AR_SETTLEIMPORTENTRY ( FBILLID );


 EXEC P_ALTERPK 'PK_T_AR_RPASETTLELOG', 'T_AR_RPASETTLELOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_RPA_FNUMBER') CREATE INDEX IDX_AR_RPA_FNUMBER ON T_AR_RPASETTLELOG ( FBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AR_RPA_DATEORG') CREATE INDEX IDX_AR_RPA_DATEORG ON T_AR_RPASETTLELOG ( FSTARTTIME ,FORGID );



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