Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Posts
    23

    Arrow Unanswered: Stored procedures: how to return the OUTPUT values?

    let say

    Code:
    create procedure sptest (@rcount int OUTPUT)
    as
    select * from workers
    set @rcount = @@rowcount
    
    return
    i am pretty new to stored proc. Pardon me if the above syntax is out. But how to utilise OUTPUT kind of variables?

    Please advise. Thanks.

    PS: trying to retrieve the number of records from table workers.

    how to execute the command in query analyser? (exec sptest wont work since it now require the output param) how to use the above in our advantage in asp, jsp, vb6, etc?

    Pls advise. Thanks.

  2. #2
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621

    Re: Stored procedures: how to return the OUTPUT values?

    From QA:

    create procedure sptest (@rcount int OUTPUT)
    as
    select * from workers
    set @rcount = @@rowcount
    return
    go
    declare @retcount int
    exec sptest @retcount OUTPUT
    select @retcount

    From ASP:

    set execommand = Server.CreateObject("ADODB.Command")
    execommand.CommandText = "something"
    .......
    execommand.Parameters.Append execommand.CreateParameter("pages", adInteger,adParamOutput)

    set rs=execommand.execute

    if not(rs.BOF or rs.EOF) then
    .......
    rs.close

    pages = execommand("pages")

    set rs=nothing
    set execommand=nothing
    Last edited by snail; 09-14-03 at 17:13.

  3. #3
    Join Date
    Dec 2004
    Posts
    6
    And how would you do this in esql/c?

    Cheers,

    AllanK

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •