I am new to Teradata. I have never tried the following MLOAD code in production environment...But this is working in my PC environment.
.RUN FILE Logon1.txt;
.BEGIN MLOAD TABLES Practise.emp1;
.FIELD Employee_Number * VARchar(13);
.FIELD Dept_Number * VARchar(13);
.FIELD Emp_Mgr_Number * VARchar(13);
.FIELD Job_Code * VARchar(13);
.FIELD Last_Name * VARchar(20);
.FIELD First_Name * VARchar(20);
.FIELD Salary_Amount * VARchar(20);
.DML LABEL UPD IGNORE MISSING UPDATE ROWS;
UPDATE PRACTISE.EMP1 SET Curr_ind_flg = 0 WHERE Employee_Number = :Employee_Number;
INSERT INTO practise.EMP1 VALUES (:Employee_Number
.IMPORT INFILE source_data.txt
FORMAT VARTEXT ','
The above code will update the Curr_ind_flg of existing records as '0' and will insert the new data with the flag as '1'. New records (which didnt exist previously) will also be inserted with flag as '1'. It will not enter any records in the Error table if update is not processed for a new Emp_ID as it should not.
Please let me know if the above code is helpful or not.