Alteryx designer Discussions

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

Change SQL Query dynamically

Highlighted
6 - Meteoroid

Adding more details to the query to be more clear.

 

I'm trying to change the SQL query dynamically. In this SQL query , only place is to change is 201701 and 202002 values , this will change for every month like 201702 and 202003 and so on.

 

Query Part to change:

SELECT  *

FROM TABLENAME

(

              'PLACEHOLDER' = ('$$STARTFYPERIOD$$', 'TurnOver_STARTFYPERIOD'),

               'PLACEHOLDER' = ('$$ENDFYPERIOD$$', 'TurnOver_ENDFYPERIOD')

)

Highlighted part should change with values like 201701 and 202003

 

I tried with Dynamic input tool but  getting below error

 

manreddy_0-1575539579003.png

Highlighted
Alteryx Certified Partner

Hey @manreddy 

 

You can use the dynamic input tool here.

 

You can feed in the values you want to change and update the SQL query as necessary.

 

Check out the 4th post on this page for an example: https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Dynamic-Input-SQL-Update-Where-Clause/...

Highlighted
Alteryx
Alteryx

@manreddy 

 

You can use the Dynamic Input to change your query dynamically. Configure it with the current query, feed the new From and To dates into the tool and configure it to modify the SQL accordingly - use the replace specific string option to update your placeholder values. Here's more on how to use Dynamic Input 

 

dynamic-sql-input.png

 

 

Highlighted
6 - Meteoroid

Thanks for your inputs, It helps me to resolve the issue

Highlighted
6 - Meteoroid

Thanks for your inputs, it helps me to resolve the issues.

Labels