Executing Stored Procedures with More than One Parameters

Last reviewed: November 2, 1994
Article ID: Q74235

SUMMARY

You may have trouble executing stored procedures from Excel if you attempt to send more than one parameter to the stored procedure.

MORE INFORMATION

If you are executing a stored procedure with more than one parameter, parameters after the first one may be interpreted as a FROM clause and causes the query to fail.

For example, if I had a stored procedure called TEST_PROC that allowed two parameters, the following would fail:

   =EXECUTE(chan,"[OPEN('TEST_PROC 12, 15')]")

Workaround

To work around this, use the Transact-SQL statement EXEC to explicitly state that you are sending a stored procedure. The following works properly:

   =EXECUTE(chan,"[OPEN('EXEC TEST_PROC 12, 15')]")

For more information on using stored procedures, see pages 245-261 of the Microsoft SQL Server manual "Learning Transact-SQL."


KBCategory: kbother
KBSubcategory:

Additional reference words: noupd


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 2, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.