I work at a governmental agency that conducts a survey once per month, and the results are stored in an SQL database. I have now started to use ODBC connection to that database, but I can not pass the info from variables to the stored procedure.
Example:
call BearbetningHamtaUtskick (@sPeriod='201502', @sSektor='G')
I want to be able to set the sPeriod from user input (to get the information from the database about the current months answers).
Using variables in Stored Procedures
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13600
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Using variables in Stored Procedures
Could you provide more information on what you're trying to do (and where EViews is involved)?
Re: Using variables in Stored Procedures
I am trying to use ODBC to get data to Eviews from an SQL database, so I can continue to work on it in Eviews. The full code is enclosed below, with uid and pwd for the ODBC source changed.
I would like to be able to use %perSQL instead of the hard coded 201502 within the call part of the PageLoad at the bottom.
Code: Select all
Mode Quiet
Close @All
%per = "1502"
%perSQL = "20" + @Left(%per,4)
%per2 = "20" + @Left(%per,2) + "m" + @Right(%per,2)
WfCreate(page=m) TestODBC m {%per2} {%per2}
%dbcred = "dsn=Dbutv;uid=eviews;pwd=eviews"
PageLoad(type=odbc,page=Utskick) {%dbcred} "{call BearbetningHamtaUtskick (@sPeriod='201502', @sSektor='G')}"-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13600
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Using variables in Stored Procedures
Code: Select all
%date = "201502"
%callcode = "{ call BearbetningHamtaUtskick (@sPeriod='"+%date+"',@sSektor='G')}"
PageLoad(type=odbc,page=Utskick) {%dbcred} %callcode
Re: Using variables in Stored Procedures
Thank you very much.
Who is online
Users browsing this forum: No registered users and 2 guests
