Run SQL Server parametrized stored procedure

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

Posts: 1
Joined: Mon Nov 13, 2017 8:59 am

Run SQL Server parametrized stored procedure

Postby vpilia » Mon Nov 13, 2017 9:19 am


I need to execute a parametrized stored procedure on MS SQL Server, that does not pull data.
It is a write-to-log in fact.
(stored procedure works fine when launched from SQL Management Studio)

Tried to open a dummy workfile but won't work

Code: Select all

wfopen(wf=xxx,page=d,type=odbc,timeout=120) Description=DEV_STG;DRIVER=ODBC Driver 13 for SQL Server;SERVER=servername;Trusted_Connection=Yes;APP=EViews;DATABASE=STG;  "{call [STG].[Eviews].[log_Eviews_staging] ('"{%param1}"', '"{%param2}"')}" @keep *
wfclose xxx

Error message:
ODBC Error unable to connect to driver: in "WFOPEN
'"CHILE"')}" @KEEP *".

Bizarrely, the same driver works few lines before on the wfsave command

Any ideas?

EViews Steve
EViews Developer
Posts: 544
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Run SQL Server parametrized stored procedure

Postby EViews Steve » Tue Nov 14, 2017 8:29 am

Try using quotes around your connection string, like this:

Code: Select all

wfopen(wf=xxx,page=d,type=odbc,timeout=120) "Description=DEV_STG;DRIVER=ODBC Driver 13 for SQL Server;SERVER=servername;Trusted_Connection=Yes;APP=EViews;DATABASE=STG;"  "{call [STG].[Eviews].[log_Eviews_staging] ('"{%param1}"', '"{%param2}"')}" @keep *

But honestly, calling a stored procedure this way via WFOPEN is probably not the best way to do it as WFOPEN will try and expect something to be returned by the call. Why don't you create a separate program that calls your stored procedure (such as via VBS script or a simple .NET console program), then call the program from EViews using SHELL or SPAWN?

Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests