Parameterize SQL table names
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello! I have a common process that I run on multiple tables within a database and want to build an analytics app that would allow my users to change the table name as needed.
I have built a process that uses actions with an update string, but the process won't run because Alteryx is trying to validate my query and it is pointing to a table that doesn't exist.
My query looks something like:
Select * from 'parameter1'_'parameter2'_data
Writing this, I realize that I could point it to a table that does exist and overwrite the strings for that table, but if that table would ever get dropped my process would stop working and I would like to avoid that if possible.
Thoughts?
Update: Pointing to a table that already exists doesn't work since it is not technically a string the replace doesn't replace and making the parameters strings causes the same failure.
Solved! Go to Solution.
- Labels:
- Best Practices
- Database Connection
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Update #2: Was able to get the string replace to work by replacing the entire table name. I had to create the full table name in a formula and use that as an input into my workflow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I was able to solve this using a dynamic input tool being fed by a text input tool that has actions.
For development, I can test my workflow by updating the values in the text input tool and keeping my parameters in the workflow don't have to worry about going back and updating them.
Example workflow attached.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I don't see any sample workbook. Can you please attach the workbook?
