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



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: 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: stored proc RETURN_VALUE.... there it is, I want to use it !!!
    ... > Then you can read the value of @total after closing the query. ... > 2 Set up your input param values. ... the result of this sql code returns an integer that is ... >> take the guts of the stored proc with hard coded guestid and meeting ...
    (borland.public.delphi.database.ado)
  • Re: Query optimization
    ... But my manager is asking me to use the existing parameter @param and not to ... I have no clue how to change this query to suit this revised requirment. ... From tblT T join tblD D on T.DEVID = D.DEVID ... Select TOP 2 D.state as state, sumas amount ...
    (microsoft.public.sqlserver.programming)
  • Re: parameter in sql query
    ... Could you try expanding the autogenerated code and posting ... > Does the parameter substitution occur after or before the query is sent to ... > being transferred to the sql server without the parameter being replaced ... '@Start' is the name of the param and the error says there ...
    (microsoft.public.dotnet.framework.compactframework)