ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Stored Procedure call and passing parameters (https://www.excelbanter.com/excel-programming/295719-stored-procedure-call-passing-parameters.html)

TLowe

Stored Procedure call and passing parameters
 
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



onedaywhen

Stored Procedure call and passing parameters
 
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.

--

"TLowe" wrote in message ...
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


TLowe

Stored Procedure call and passing parameters
 
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!

"onedaywhen" wrote in message
om...
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.

--

"TLowe" wrote in message
...
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




onedaywhen

Stored Procedure call and passing parameters
 
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.'

--

"TLowe" wrote in message ...
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!

"onedaywhen" wrote in message
om...
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.

--

"TLowe" wrote in message
...
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



All times are GMT +1. The time now is 03:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com