Microsoft KB Archive/74235

{| = Executing Stored Procedures with More than One Parameters =
 * width="100%"|

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,&quot;[OPEN('TEST_PROC 12, 15')]&quot;)

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,&quot;[OPEN('EXEC TEST_PROC 12, 15')]&quot;) For more information on using stored procedures, see pages 245-261 of the Microsoft SQL Server manual &quot;Learning Transact-SQL.&quot;
 * }