How to define in sql server the same parameter as input and output?

  • Hi all,

    Please help me in solving following query.

    Can we define in sql server the same parameter as input and output?

    How to do it?

    Thanks and regards,

    Swapnil.

  • Did you hear about the magic and power of knowledge hidden behind the key {F1}?

    _____________
    Code for TallyGenerator

  • Friend, I had tried it but could not get the answer, that is why I have post question over here. If you know the answer please post it for me.

  • OK, start exersise from the beginning.

    Being in EM or QA press {F1}.

    In Index tab type "output parameters".

    Press Enter.

    In the list appeared find "Returning values using OUTPUT parameters".

    Select it and press OK.

    Is it what you are looking for?

    Is it rocket science?

    _____________
    Code for TallyGenerator

  • I think you are not getting my quetion.

    My question is, How to define same parameter as input and output both.

    for ex. Suppose I have a '@num int' parameter in my stored procedure. How can I define the same (i.e. @num) as input parameter and output parameter both.

    I know how to define input  parameter and output parameter separately. But I don't know how to define same parameter as input as well as output both.

    I hope you got it.

  • There are no output only parameters.

    OUTPUT parameter is INPUT as well.

    Just dare to use it.

    _____________
    Code for TallyGenerator

  • Here's an example, Swapnil,

    --objects

    create proc #sp1 @x int output as

    set @x = @x + 1

    go

    --calculation

    declare @x int

    set @x = 7

    exec #sp1 @x output

    select @x

    --tidy

    drop proc #sp1

    /*results

    -----------

    8

    */

    Please forgive Sergiy's bitterness. He means well...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • Thanks Rayan,

    Thanks very much for help.

    Regards,

    Swapnil.

Viewing 8 posts - 1 through 7 (of 7 total)

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