Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
vvvvvvizard
Partner - Specialist
Partner - Specialist

Loop through a store proc passing a paremeter

Good day

I need to loop through this passing 'December 2019' , 'January 2020' and 'February 2020'  as parameters into the sql statement 

Stats:

Load*;

SQL  EXEC Report.Prior_Month_Substitution @FinancialPeriod = N'January 2020';

 

Can this be done in Qlik or only using SQL code . 

Labels (1)
1 Solution

Accepted Solutions
dgreenberg
Luminary Alumni
Luminary Alumni

I don't see why you can't do it with a for next loop in the load script.

Something along the lines of:

let myParm1='December 2019';
let myParm2='Januuary 2020';
let myParm3='February 2020';

for A=1 to 3
let mySQL='SQL EXEC Report.Prior_Month_Substitution @FinancialPeriod = N' & myparm&A;

Load *;
mySQL;
next A;

View solution in original post

2 Replies
vvvvvvizard
Partner - Specialist
Partner - Specialist
Author

I just need to pass the last 3 months dates into the parameter

dgreenberg
Luminary Alumni
Luminary Alumni

I don't see why you can't do it with a for next loop in the load script.

Something along the lines of:

let myParm1='December 2019';
let myParm2='Januuary 2020';
let myParm3='February 2020';

for A=1 to 3
let mySQL='SQL EXEC Report.Prior_Month_Substitution @FinancialPeriod = N' & myparm&A;

Load *;
mySQL;
next A;