Output/return parameters in TSQL

  • Hi,

    I know this question is VERY simple but I cannot find the answer anywhere: what is the difference between an output and return parameter in TSQL?

    Thanks

  • OUTPUT parameters can also be used as input parameters in a stored procedure and are defined in the parameter section of a stored procedure. Please see "CREATE PROCEDURE" in Books Online for additional details.

    RETURN parmeters are the integer that follows a RETURN statement. Please see "RETURN statement" in Books Online.

    While you can have many OUTPUT parameters, you can only have 1 RETURN parameter at a time because the RETURN statement only allows the return of a single integer expression at a time.

    To see how they are actually used, please see "EXECUTE statement, EXECUTE (Transact-SQL)" in Books Online where you'll find that RETURN returns the @return_status. Read the OUTPUT section in this same BOL article for how OUTPUT parameters work.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply