create around 800 helper tables with ADF

Janice Chi 580 Reputation points
2025-08-11T16:36:53.5133333+00:00

We have a requirement in our project to create around 800 helper tables in DB2, each with specific columns (row_hash calculation, table_name, primary column, partition column, partition value).

We have tried two approaches so far:

  1. Using a stored procedure in DB2 with a loop to create the tables dynamically.

Using a DB2-compatible script in ADF lookup with a loop for each activity.

In both approaches, we are facing challenges:

In Approach 1, we are unable to use the loop stored procedure dynamically with only the schema_name as input.

In Approach 2, ADF treats the SQL as a single query or CALL and won’t parse BEGIN..END procedural code unless it’s inside an SP.

Given these issues, we need to:

Dynamically fetch table_name, primary key column, partition column, and partition value in a loop so we don’t have to manually create helper tables.

Input only the schema_name and have the loop/stored procedure create helper tables for all tables in that schema.

Can you please advise how this can be achieved using DB2 and ADF, and what Microsoft-recommended approach or best practice we should follow to meet this requirement? Also, if there are any known limitations or considerations, please share those.

While running the stored procedure RNMOODENG.LOOP_CREATE_HELPERS in DB2 from ADF (via JDBC), the execution failed with the error:

[SQL0204] TABLES in SYSIBM type *FILE not found (SQL State: 42704, Vendor Code: -204).

REQUEST NOT TO SEND GPT RESPONSES AS I HAVE PAID VERSION OF GPT 5 :)

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.