Stored Procedure call and passing parameters

T

TLowe

Hello
Can a SQL stored procedure be called (it takes five parameters) from Excel?
Can a "For Next loop" be used to supply those variable parameters? If you
use parameters do you call them the same way that you would in VB?
Thanks
 
O

onedaywhen

There are various ways of calling a parameterized stored procedure,
depending on data access technology used (ADO, ODBC, MS Query, etc)
and the DBMS product itself ('SQL' is vague - if you mean SQL Server,
say so). Post back with some more details, otherwise it's hard to
generalize.
 
T

TLowe

Thanks for the answer. Sorry to make the question to general.
I would like to use the ado command object to pass parameters to a stored
procedure in a MS2000 SQL server. I am currently just passing the query
back as a string. This is common in VB and I have used that in VB projects.
I need to do some modification and was wondering if Excel would support and
be able to use the command object to send a request to SQL server with
multiple parameters. Here is a sample of the method I am familiar with to
add a parameter to the command object.(watch for line break).

cmdStoredProc.Parameters.Append
cmdStoredProc.CreateParameter("@QuestionNumb", adInteger, adParamOutput, ,
mvar2)
Thanks for any help!

There are various ways of calling a parameterized stored procedure,
depending on data access technology used (ADO, ODBC, MS Query, etc)
and the DBMS product itself ('SQL' is vague - if you mean SQL Server,
say so). Post back with some more details, otherwise it's hard to
generalize.
 
O

onedaywhen

Thanks for the additional info but I'm sorry, I still don't get what
you are asking.

If your question is, 'Can I modify this code to add multiple *input*
parameters?' then the answer is, 'Yes, append them to the Command's
paramters as per your existing code does but specify adParamInput.'

--
 
Top