Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Conditionally Creating a New Table

I have a job that compares a master table with a stage table every day, compares changes, and then does an incremental load of any new or changed records. This all works fine, EXCEPT the very first time the project is run, since the Master table does not exist yet. Is there any combinations of components or someway to only create the master table if the table does not exist already? This way, the master table will get created the first time the job runs (since it doesnt already exist)...but then on subsequent runs, the master table will not get created again (since it already exists) and will just have the data since the last run. Any way to do this?

1 Community Answers

Matillion Agent  

Ian Funnell —

Hi James,

The Create/Replace Table component has a “Create/Replace” setting, and you can choose:

  • Create – which will fail if it already exixts
  • Create if not exists – which is what you need
  • Replace – drop if it already exists

So you should use a “Create if not exists” for your Master table. You could then safely run it every day.

Some customers choose to have a one-off “setup” job for initial DDL.

Best regards,
Ian

Post Your Community Answer

To add an answer please login