Happy 8th birthday to the Maveryx Community! Take a walk down memory lane in our birthday blog, and don't miss out on the awesome birthday present that all Maveryx Community members get to take advantage of!

Alteryx Designer Desktop Discussions

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

Set multiple Primarykey with Change Entire File Path

8 - Asteroid


I created multiple tables with the Outputtool in my Database.
In this example i created 3 tables.

But now i would like to set a primarykey for each of the tables.


i know that i can do it with Pre/Post-Create SQL statements but only for specific tables right? But how to do it for 50+ tables that i want to creat? https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Create-Database-Table-Primary-Key-i...


What would be the best way to automated creat those primarykeys for multiple tables after table creation in alteryx?


10 - Fireball

Hi @df - I think I would convert the workflow to a Batch Macro so that each table gets created one by one. I would set up a control parameter that contains the create table statement and updates the PreSQL configuration with each loop. You would also want to change the Output Options to Append Existing as the table would get created in the PreSQL. A sample of what this might look like is below. Alternatively, you could update the PostSQL to assign the primary key after the table is written.


Screen Shot 2021-01-08 at 8.20.09 AM.png