Check if a database table exists before proceeding?

Hi community,

I have a morph that imports data into SQL. The issue is if the table doesn’t exist then I want it created and imported into that table. That part is done with with the Custom SQL that I run prior to the export.

The issue I have is if the data I’m retrieving is already existing in the table, I want it to skip it.

The vision I see here is,

  1. Query the table, if the table exists, then merge the table and remove those that are matching rows

I tried to do this by using a Database command, where I could check the object_id from the sys.objects table to see if it exists but it doesn’t seem to do or return anything. If I run this with a existing or non existing table results are the same, just blank (no errors).

Any idea how I could do this?

Thanks
Flowy

The “Database command” action now has the “List tables” command, so you can check if the table already exists.

image

1 Like

Hi Dmitry,

Will this work by parameter?

Thanks
Flowy

Hi Flowy,

What do you mean?

Thank Dmitry!!! I just tested it and your right this will work!!!

Flowy