[dba-SQLServer]Sproc Output to VB?

Mark Rider theoden11 at attbi.com
Sat May 3 20:43:43 CDT 2003


I have gone stupid looking for the answer to this.  I have a sproc that
calculates an average of several numbers, and runs fine in QA.  I cannot figure
out how to capture the output of the sproc so I can display it in anything other
than QA, MSQuery, etc.

The sproc is:
CREATE PROCEDURE [sp_LongMA] 
@inparam datetime,
@inparam2 datetime,
@MA money OUTPUT
AS
Select Avg (QQQValue) AS MovingAverage From tblQQQ  
Where  (QQQTime BETWEEN @inparam AND @inparam2)
GO

I call it from VB6 like so:

ssql_Fast = 
DECLARE @MA1 datetime 
DECLARE @MA2 datetime 
DECLARE @MA money 

SET @MA1 = '" & FastTime1 & " '
SET @MA2='" & FastTime2 & "' 
execute sp_LongMA @MA1, @MA2, @MA = @MA OUTPUT 

Again, it runs with no errors, but also with no indication of a returned value.

How do I write the @MA OUTPUT (the average) to a variable that I can access thru
VB6?   I set up an ADODB.Recordset in VB, call the sproc as above and get no
errors, but I cannot figure out what to look for in the returned recordset to
get the value of @MA.

TIA,

Mark Rider



More information about the dba-SQLServer mailing list