/**Begin D:\PDM_UPGRADE_1.3\PDM_UPGRADE\pdm1\RIM_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_RIM_INV_TRAIN_REFUND', 'T_RIM_INV_TRAIN_REFUND', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RIM_INV_TRAIN_REFUND') CREATE  CLUSTERED INDEX IDX_RIM_INV_TRAIN_REFUND ON T_RIM_INV_TRAIN_REFUND ( FSERIAL_NO );

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


 EXEC P_ALTERPK 'PK_RIM_INV_FINANCIAL', 'T_RIM_INV_FINANCIAL', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RIM_INV_FINANCIAL') CREATE  CLUSTERED INDEX IDX_RIM_INV_FINANCIAL ON T_RIM_INV_FINANCIAL ( FSERIAL_NO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RIM_INV_FINANCIAL_NO') CREATE INDEX IDX_RIM_INV_FINANCIAL_NO ON T_RIM_INV_FINANCIAL ( FINVOICE_CODE ,FINVOICE_NO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RIM_INV_FINANCIAL_TAXORG') CREATE INDEX IDX_RIM_INV_FINANCIAL_TAXORG ON T_RIM_INV_FINANCIAL ( FTAX_ORG );


 EXEC P_ALTERPK 'PK_T_RIM_INV_FINANCIAL_ITEM', 'T_RIM_INV_FINANCIAL_ITEM', 'FENTRYID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_RIM_INV_FINANCIAL_ITEM_FK') CREATE  CLUSTERED INDEX IDX_RIM_INV_FINANCIAL_ITEM_FK ON T_RIM_INV_FINANCIAL_ITEM ( FID );


 EXEC P_ALTERPK 'PK_T_RIM_INV_FINANCIAL_ITEMA', 'T_RIM_INV_FINANCIAL_ITEMA', 'FENTRYID', '1';

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



/**End D:\PDM_UPGRADE_1.3\PDM_UPGRADE\pdm1\RIM_constraint.sql **/
