Nested Procs Or Single Proc

  • Hi,

    I need to know which one gives a faster output: (A Nested Proc Or A Single Proc that has the definition of that Nested Proc)

    Thanks in Advance

    "I Love Walking In The Rain So No One Can See Me Crying ! " ~ Charlie Chaplin

  • If the nested proc only works on one row at a time... "Death by SQL". 😉

    --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)

  • It depends on the SP logic.

    1) If your SP contains statements which is repeating through out the SP then create Separate SP for those statements. In this case creating Nested SP gives better performance.

    2) if your SP contains too many if conditions and execution of statements depends on the previous statement result or passed parameters or any hard coded values then better to use Nested SP.

    3) If all the statements are unique and non repetitive statement then better to use Single SP.

  • Thanks

    "I Love Walking In The Rain So No One Can See Me Crying ! " ~ Charlie Chaplin

  • Its a general question that you have asked. There are pros and cons for both.Whats the prupose you are trying to achieve?

    "Keep Trying"

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

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