Page 1 of 1

Macro variable in calling SQL SP

Posted: Thu Dec 15, 2011 9:00 am
by MSQ1
Hi,

I'm wondering if I can use a string variable when calling a SQL SP? I want the program to loop when it's fetching data for different dates.

Now I have:
wfopen(type=odbc) "tycheodbc" "{call spEXFGetClose ('2008-11-03')}" @keep *
where you enter the date manually each time

I want the program to do the analysis for X consecutive days, hence I would like to do something like:

%day_1= "2008-11-03"
%day_2= "2008-11-04"
...
%day_X= "2011-11-03"

for !i=1 to X
%day=%day_{!i}
wfopen(type=odbc) "tycheodbc" "{call spEXFGetClose ('{%day}')}" @keep *
next

where you don't have to enter the date and run the program manually X times.
/Maria

Re: Macro variable in calling SQL SP

Posted: Thu Dec 15, 2011 9:10 am
by EViews Gareth

Code: Select all

for !i=1 to X %day=%day_{!i} %command = """{call spEXFGetClose ('" + %day + "')}""" wfopen(type=odbc) "tycheodbc" {%command} @keep * next
or something along those lines