Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 OUTPUT correct value in sp

Author  Topic 

kelleyb
Yak Posting Veteran

61 Posts

Posted - 2001-10-22 : 15:54:18
I've simplified the syntax below to make the question easier to answer.

I have a COM object that calls a single procedure, passing a single parameter, and expecting a single return value. The procedure looks like this:

CREATE PROCEDURE (procedure1)
@Var1
AS
DECLARE @LocalRetVal, @@Var2
EXEC procedure2 @Var1, @@Var2 OUTPUT

IF @Var2 = 'this'
SET @LocalRetVal = 'value1'
ELSE
SET @LocalRetVal = 'value2'

SELECT @LocalRetVal

Now, because I accept an OUTPUT value from "procedure2", which is necessary only for "procedure1", the order that values are displayed is incorrect. I get the ubiquitous "Item cannot be found in the collection corresponding to the requested name or ordinal". When I run "procedure1" in QA, I see that "procedure2" is displaying the value of *it's* query.

Is there a way to "silence" the output of procedure2 so that procedure1 returns only the value I've requested?

Your expert help is appreciated. :)

-Brian

Edited by - kelleyb on 10/22/2001 15:57:04
   

- Advertisement -