keyongtech


  keyongtech > sqlserver.* > sqlserver.programming > 10/2005

 #1  
10-07-05, 07:15 PM
standish22
OK, here is what I have.

Proc1 defines some variables within it, say one is @Amount1 and
@Amount2. (These are not parameters passed to proc1, they are
variables within it)

Proc2 is defined to take some parameters, the last of which are defined
as output parameters: @Amt1, @Amt2.

When executing Proc2 from VB.NET code, I can access the output
parameters @Amt1 and Amt2 fine.

When I try executing the stored procedure from another stored procedure
(passing the same values as I did in .net) I get null values for Amt1
and Amt2.

I copied proc1 into Query Analyzer. Here is what the line looks like

*******************************************
EXEC proc1 @CheckDate, @PersonID, @Amount1, @Amount2

select @Amount1
*************************************

The "Select @Amount1" returns a null value.

Any ideas?
 #2  
10-07-05, 07:34 PM
Raymond D'Anjou
It is better to always name the parameters when executing a stored
procedure.
Specify the the last 2 parameters are OUTPUT:
EXEC proc1
@chkDate = @CheckDate,
@persID = @PersonID,
@amt1 = @Amount1 OUTPUT,
@amt2 = @Amount2 OUTPUT

<standish22> wrote in message
news:2040
[..]
 #3  
10-07-05, 07:35 PM
Andrew J. Kelly
EXEC proc1 @CheckDate, @PersonID, @Amount1 OUTPUT , @Amount2 OUTPUT

http://www.support.microsoft.com/?id=262499
 #4  
10-07-05, 07:43 PM
standish22
AWESOME! thanks guys.
Similar Threads
SQL Server stored procedure output parameters.

Hello. I'm having difficulty getting the value of output parameters from stored procedures on a SQL server. I understand that this just doesn't work with odbc so I've tried...

Stored Procedure with Output Parameters

Hi all I'm tryng to use MSDAORA access in a Oracle 9 database. I have a stored procedure named TEST with this Sign : PROCEDURE TEST ( PC_01 IN VARCHAR2 ,PC_02...

Using Stored Procedure at sqlDataAdapters with output parameters

declare @Count int select @Count = COUNT ( * ) FROM tblXUDUserShip select FirstName,SurName,@Count AS BankaSayisi FROM tblXUDUserShip I have a Stored Procedure Which...

Output Parameters set by Stored procedure

HI, Trying to set a Global Variable using output from a stored procedure. I'm using a row value. The stored procedure variable is declared as varchar(200). The Global...

Stored Procedure Output Parameters

I have a Stored procedure in SQL, that works, when tested in SQL, with one input & several output parameters, as follows: CREATE PROCEDURE myProcedure @MyID int , @First...


All times are GMT. The time now is 11:21 AM. | Privacy Policy