Re: stored proc RETURN_VALUE.... there it is, I want to use it !!!



out of the woods:

Brian... for some reason I can't seem to work with you parameters.refresh...
when I use it I appear to assign the parameters properly... I thing, please
correct me if I'm wrong.. but when I open the stored proc I get an nasty
exception on sqloledb.dll... strange thing is that it only happens the
second time and subsequent times.

Problem with my old and now much preferred method was, you won't believe
this, I'm having trouble with it... but, where the stored procedure was
defined with variables @meetingCode char(6), @guestID char(10) I could not
create them in code 1. guestID and 2. meetingCode... have to create them 1.
meetingCode and 2. guestID. Ya!... what's up with that? when I switched
the order in which I was creating the 'named' parameters life is good, sweet
and prosperous... if anyone can explain my anomolies, confusion and
misperception to me please have at it...

Now I can go after retrieving an output value....
thanx
b
"Ron" <noone@xxxxxxxxxxx> wrote in message
news:42701b3b$1@xxxxxxxxxxxxxxxxxxxxxxxxx
> Betsy,
> I sent you this earlier on. This does work on my system.
> D6 + ADOExpress + SQL Server 2000 Desktop Edition.
>
> CREATE PROCEDURE dbo.getPayments
> @meetingCode char(6),
> @guestid char(10),
> @total int OUTPUT
> AS
> SELECT @total = SUM(amount)
> FROM dbo.payments
> WHERE meetingCode = @meetingCode AND guestid = @guestID
> GO
>
> Then you can read the value of @total after closing the query.
>
> You will have to add the @total param as an int with a direction of
> pdOutput.
>
> So, the method you could use would be
> 1 Put your hair back in.
> 2 Set up your input param values.
> 3 Open the query.
> 4 Close the query.
> 5 Read the integer value of the @total output param.
>
> Note, the result of this sql code (in @total) returns an integer that is
the
> sum of the 'amount' column from the 'payments' table.
> Is that what you wanted?
>
> Good Luck,
>
> Ron.
>
> "Betsy" <betsy.a.tainer@xxxxxxxxxxxxx> wrote in message
> news:427007d2$1@xxxxxxxxxxxxxxxxxxxxxxxxx
> > SEVERELY STUMPED...
> >
> > I've started a whole new project... eliminate absolutely everything but
> this
> > one stored procedure... nothing...
> > it appears to run okay... returns field heading for the return value...
no
> > value... regardless of what I tell it to do...
> >
> > skip the sum(amount)... just give * (every flipping thing)... same
> thing...
> > field headings... no values...
> >
> > hard-code the guestid and meeting code... same thing...
> >
> > take the guts of the stored proc with hard coded guestid and meeting
code
> > and run it as a normal sql statement in the enterprise manager... all is
> > well... I'm at a total loss. This is such a basic thing and I've done
it
> > over and over again... I don't understand why it's not working.
> >
> > HELP!
> >
> > ideas? authorities... ??? all appears to be okay... signon as dbo... so
> > should have authority... no errors....
> > b
> <snip>
>
>


.



Relevant Pages

  • Re: Passing in a Parameter
    ... >I have a Stored Proc and would like to pass in a VARCHAR parameter. ... >problem is that the query will need to use it in a IN clause... ... >DECLARE @PARAM AS VARCHAR ...
    (microsoft.public.sqlserver.mseq)
  • Passing in a Parameter
    ... I have a Stored Proc and would like to pass in a VARCHAR parameter. ... problem is that the query will need to use it in a IN clause... ... DECLARE @PARAM AS VARCHAR ...
    (microsoft.public.sqlserver.mseq)
  • RE: parameter in sql query
    ... Just set connection string to run it. ... > If the substition is before...the error seems to imply that the query is ... > being transferred to the sql server without the parameter being replaced ... > creating a datacomponent with a sql param, ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Dynamic use of Access query
    ... > But this code needs to add parameters from the query: ... > Set adoCmd = New ADODB.Command ... EXECUTE (this is what the ADO Command object is using under the hood ... If you are saying your stored proc doesn't have any parameters, ...
    (microsoft.public.excel.programming)
  • Re: Stored procedure never finishes
    ... Perhaps when you run the query without the date range, ... You do this by issuing "exec sp_lock [spid]" with spid being ... SQL Server MVP ... > I have a stored proc that won't finish. ...
    (microsoft.public.sqlserver.server)