Page 1 of 1

Set preloaded statement in target table?

Posted: Wed Dec 08, 2010 12:56 am
by ylai20
I want to load data into a target table that it has time_key (yyyymm).
I may reload data few time to this table. For second time reload, i need to delete the data which belong to the same time_key to avoid duplicated record.

Currently what i am doing is i create a job
Seq file > Transformation > odbc (in enter sql > delete from xxx where time_key=201011), something like workaround.

Is the any better way to set the delete statement in target table before the real data is load into the table?

Thanks.

Posted: Wed Dec 08, 2010 3:53 am
by ray.wurlod
Use an Open command in the "real data" job to delete the records (if any).

Posted: Wed Dec 08, 2010 7:56 am
by chulett
Two ODBC links, one for the delete and one for the inserts. Make sure only the first row goes to the delete link before it goes to the insert link.

Posted: Wed Dec 08, 2010 7:04 pm
by ylai20
chulett wrote:Two ODBC links, one for the delete and one for the inserts. Make sure only the first row goes to the delete link before it goes to the insert link. ...
Sorry, you mean ODBC --> Transformation --> ODBC (delete) --> ODBC (Insert)?