Alteryx Designer Desktop Discussions

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

Declaring Variables in SQL Editor - Is it Possible?

Mitch_S
7 - Meteor

I really need to be able to DECLARE/SET variables in the SQL Editor in the INPUT tool. I've only found "Use the Alteryx GUI Instead" as an option in the community fora, but that is not an acceptable option for me since my SQL code sets are used both with and without Alteryx.

Is there any syntax I can use that will allow me to implement this type of SQL command in Alteryx?

DECLARE @Start AS DATE;

SET @Start = '1/1/2023';

3 REPLIES 3
danilang
19 - Altair
19 - Altair

Hi @Mitch_S 

 

Can you provide more information about what your doing with @Start variable in your SQL.  With more info, we might be able to come up with a work around.  I have a feeling that using a Dynamic Input tool and replacing parts of the template string might the way to go, but I can't be sure without some details of your use case.

 

Dan

Mitch_S
7 - Meteor

Hey danilang,

 

Here is are some variables I routinely set.

 

 

DECLARE
@Reporting_Period VARCHAR(254)
,@Start_Date DATETIME
,@End_Date DATETIME
,@SA VARCHAR(4);

SET @SA = '158'
SET @Reporting_Period = 'Use Custom Period'
SET @Start_Date = '6/01/2012'
SET @End_Date = '5/31/2013';

Labels