Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Using parameter in SQL statement

BI_Pleb
7 - Meteor

I'm currently extracting data from a Teradata database via ODBC connection and SQL statements. I would like to added a parameter to Alteryx workflow that is used as part of the SQL being through. e.g

 

Select A.Field1, A.Field2

From DB.Table A

Where A.Field1 in (‘parameter’, ‘parameter’)

 

Any advice on how to do this?

 

4 REPLIES 4
michael_treadwell
ACE Emeritus
ACE Emeritus

The Dynamic Input tool is what you are looking for. It allows you to modidy a SQL Query based on fields in your Alteryx data stream.

 

In the tool configuration you will see a dropdown menu 'Add'. One of the options is 'SQL: Update WHERE Clause'

AndrewW
11 - Bolide

You could have the Input tool containing the SELECT statement as a macro and set up a Control Parameter and Action to pass in the parameter values, replacing the specific string in the select statement. Something like in the attached screenshot (I can't upload into this post for some reason...so had to put into a word doc)

 

 

BI_Pleb
7 - Meteor

Thanks for the quick responses! 

Both solutions logically make sense so will give them both a go and see which feel more comfortable with.

Raghu_s
8 - Asteroid

Hi @michael_treadwell 

 

Thanks for the input. I tried using this logic and it holds for where clause having one parameter. what if have multiple parameter to select/input different values each run? when ever I use the dynamic input tool and the pop up window shows only one of the clause used in where condition. 

 

Ex: Products to choose from, date filters to choose from, categories to choose from. 

 

Looking forward. 

Labels