Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Dynamic "DROP TABLE" SQL statement

robertlane
5 - Atom

Hi All.

 

I'm having trouble figuring something out and I was hoping that someone in the community could help.

 

I'm writing a workflow that creates a daily backup of a specific SQL table. The workflow dynamically creates a table with today's date ('backup_20190729', for example) and then fills that table with the data. That process is clear and works fine.

 

Now the problem. I want to keep the past 31 days/tables and, when a new backup is created, drop the oldest table. I have worked out the process to identify the table to drop but I cannot figure out a way to dynamically drop that table. I know that you can run pre & post SQL statements but it looks like that only accepts a static statement. I also tried using a Dynamic Input tool and then updating the SQL command dynamically, but it adds a 'SELECT ' in front of it.

 

Is there any way to dynamically drop a SQL table?

 

Thank you for anything you can add, even if it's telling me to stop looking.

2 REPLIES 2
robertlane
5 - Atom

I figured it out. I was missing a Control Parameter. I adapted the solution from here.

sudha_moluguru
5 - Atom

Can you post your workflow here for reference

Labels