Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

Set multiple Primarykey with Change Entire File Path

df
8 - Asteroid

Hello,


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.

df_0-1610111697026.png


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?

Cheers
David

1 REPLY 1
morr-co
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

Labels