Return resultset or use OUTPUT parameters in SP

  • Hi,

    If I have a stored procedure that only checks if a customer exists (simple case) it's better to use an OUTPUT parameter or return a data row?

    When returning single rows of data what's the best practice for stored procedures? OUTPUT parameters or resultsets?

    Thanks,

    Pedro



    If you need to work better, try working less...

  • PiMané (10/2/2012)


    Hi,

    If I have a stored procedure that only checks if a customer exists (simple case) it's better to use an OUTPUT parameter or return a data row?

    When returning single rows of data what's the best practice for stored procedures? OUTPUT parameters or resultsets?

    Thanks,

    Pedro

    1. If your procedure returns just a bit Yes/No flag, I would suggest using OUTPUT (BIT type) parameter or RETURN value (INT type). It would be overkill to return it as resultset.

    2. When you need single or multiple ROW of data, the best practice is to return it as resultset.

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

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

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