An input/output parameter to a SP

  • I'm working on a new stored procedure, which want to to return a couple of scalar values with. One will always be an output parameter; this is easy and I've done it before. However, the other is one that could be both an input parameter (and if so, it will not return anything), or it could be an output parameter. I know from ADO.NET programming that parameters could by bidirectional. I just don't know how to specify this in a stored procedure. How do I specify a parameter as being both an input and an output parameter?

    Kindest Regards, Rod Connect with me on LinkedIn.

  • All you have to do is specify it as an OUTPUT Parameter in the stored procedure. Then you need to check the value to decide if you want to use it or not within the procedure. Of course the value in it will always be passed back out by the SP so you need to also decide if you want to use it in your application.

  • To paraphrase Jack: There actually aren't any output only parameters in SQL procedures. They are all either input-only or input/output. You use the OUTPUT keyword in both the procedure definition and its invocation to designate the input/output parameters.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Thank you Jack and RBerry.

    Kindest Regards, Rod Connect with me on LinkedIn.

Viewing 4 posts - 1 through 3 (of 3 total)

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