Start Free Trial

Alteryx Designer Desktop Discussions

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

How to run SQL with parameters in Alteryx

AgnesL
7 - Meteor

Hi, my colleague built a SQL but it requires parameters. How can I do that in Alteryx? I assume I would need an input file and somehow "join" them? For example, I have a sales table but I only need it to populate for a specific month and specific year. Thank you for your help.

5 REPLIES 5
Deano478
12 - Quasar

@AgnesL yes you would need an input data tool and in the config you will want to go to data sources and select the appropriate driver OleDB or ODBC and from there once you authenticate and connect you can click on the table SQL Editor and write a SQL query to meet your needs/feed in parameters 

alexnajm
18 - Pollux
18 - Pollux

The main question would be, where are those parameters coming from?

 

If they are from a user, you'd use the Interface tools to connect into your Input Data tool and have the Action tool between them update the placeholder value in the query

 

If they are from another file, you'd read in that file and use a Dynamic Input after to Modify the SQL query based on the values from your input

AgnesL
7 - Meteor

@alexnajm @Deano478  Thank you both for sharing. This should give me a general idea of where to start playing around.  👍

AgnesL
7 - Meteor

@alexnajm  

I ran into a problem, how do I do multiple clauses in one?

I want to run for Jan 2024, Feb 2023, and Mar 2022 but the window only allows one clause per the drop-down menu. Thank you for your help.

 

2024-09-10_11-58-31.jpg

2024-09-10_12-01-17.jpg

alexnajm
18 - Pollux
18 - Pollux

@AgnesL The set up that I see here would run three queries because it has the three rows of parameters, and would run the way that it seems like you want. 

Labels
Top Solution Authors