reject records needs to be collected in a table

Records needs to be imported into a stage table from file. while loading into table, some records has length error and datatype mismatch columns.

Currently the script is getting aborted whenever it encounter length/datatype mismatch column records.

req: the job should not abort instead it has to reject and continue loading valid records (next records). Hence at the end, all the rejected records needs to be collected in a another stage table called error table.

Re: reject records needs to be collected in a table

Insert all the records into a "staging" table with wide varchar columns, wide enough to absorb your longest data for the column, assume every record is an error record. From there set your insert query into the desired target table to check the length and, optionally the data type. The records that are loaded are the "good" records, the ones not loaded are your error records.