Scenario:
We do a data load. We get word the source files provided were incorrect. We get new source files. We want to delete appropriate records from the target tables prior to the (re)load (i.e. any records in the target tables matching the effective date(s) in the new source files).
Some details:
The metadata for records to be deleted will be stored in a utility table in the database.
The SQL to delete the appropriate records will be custom, user generated SQL for each table. The SQL will be static, i.e. not parameter driven.
The deletions must be done in a particular order due to FK constraints.
Each deletion must run to completion before the next one begins.
Job Approaches:
1) Put all the SQL (hundreds or thousands of lines) in a single DRS stage (before or after tab?) to do the deletions. Dummy up some sequential file "input" and "output" to get the job to compile.
2) Write a stored procedure(s) and call that.
3) Use a separate DRS stage for each target table affected. Put sequential stages (/dev/null) between each one to ensure that each "parent" stage runs to completion before the next "child" stage starts.
My initial thoughts were to use #3. I threw together a quick test job as follows:
Code: Select all
seq file 1 --> DRS --> seq file 2
Output tab:
Stage uses filter commands
File = /dev/null
Filter = "printf "Running next stage...\n" "
Link colum: Dummy, varchar 50
DRS:
Input tab:
User-defined SQL
Columns: Dummy, varchar 50
SQL: SELECT 'Running next stage...'
Output tab:
Select <column list> FROM <source table>
I might change this to "TOP 100" or distinct - whatever helps debugging best when selecting "View link data" in Designer
seq file 2:
/dev/null
Append to existing file
Columns: <column list> FROM <source table>
Questions:
1) What is your recommendation as best practice to approach this problem?
2) Regardless of #1, I'm experiencing the problem "SQL data type '%1' defined on column %2 is not supported." The problem occurs in the custom, user generated SQL in the Input tab of the DRS stage.
What does this cryptic message mean, and how do I get rid of it? Is it documented in the doc set anywhere? Note that every "View <linkname> data" RMB selection works - it just fails when I submit the job.
I did see viewtopic.php?t=88850&highlight=SQL+dat ... +supported. before posting. Tried various things in that post (:1 , : ?, ?) but couldn't get it to work.
Thanks,
Scott