Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Updating a SQL Query from an output, is this possible?


So I don't know if this is possible...but figured it would be worth asking. The top data set I am creating a unique key with the formula tool. I then would like to use those new values (unique key generated) and somehow auto insert those unique key's created and only pull those back with my 2nd data set that is joined below and then using the join tool only produce the ID found in both data sets. 


Is this possible?





I forgot to mention, I then would like to take these results after the join is successful, have an output created, but then take those results and join them to another table for further results


Hi @dberroth ,

With Alteryx  you can run and  test  each step  or  after you add  a new tool  and continue after  making sure the result is good. 

Same output  can be used as input  to multiple tools .  The data  for  writing  output file  can also become input to another join . 



Thanks for the info, I guess my question still remains though if I can take the new "uniquekey" value that is created by dataset1 formula,  and somehow have those values automatically "entered" into the SQL(for dataset2) as the dataset criteria for what to pull in to then join those unique values for the output.




Hi @dberroth ,

You can  move   data  into database   via in-db  'data stream in'   tool . I don't  think there is  an automatic  way to do this .

Alteryx Certified Partner

Hi @dberroth 


As @benakesh mentioned, In-DB is probably the easiest way to go. However, if that's not an approach you can use for whatever the reason, the other option would be to use the Dynamic Input tool.


The template query (within the Dynamic Input tool) would be setup something like...



FROM mytable

WHERE UniqueID IN('placeholder')


Next, you'd select the "Modify SQL Query" option and "Add" the option to "SQL: Update WHERE clause and configuring it to replace your "placeholder" string with the concatenated string.


One to watch out for though... there could be a limit to how long an IN statement can be. There's a setting that, by default, will cut it off at 1000 characters, which you can adjust. if the concatenated string is over that value, it'll prepare another query for execution with the next set of characters, however, it may have cut a value in the middle.


I know there's plenty of articles and posts around Community that talks about this in more detail in case you're still getting stuck.


Hope this helps!

Teknion Data Solutions