Logic for order in calling procedire

  • Hi, I have sp_master which calls other sp like below, is it true that sp_B will never start unless sp_A will successfully finished ?

    Assume that it's default system config, I'm on 2012.

    EXEC dbo.sp_A

    EXEC dbo.sp_B

    EXEC dbo.sp_C

    Thanks

    Mario

  • Your stored procedures aren't really prefixed with sp_ ? You know that's for system stored procedures, right?

  • Tx,

    They are not really mine, but yes - they are named sp_*, which is doesn't matter for my case I thought.

    + they have at the very top like below, so I think they don't go to Master.

    Use Alpha

    Go

    M

  • mario17 (2/24/2016)


    Tx,

    They are not really mine, but yes - they are named sp_*, which is doesn't matter for my case I thought.

    + they have at the very top like below, so I think they don't go to Master.

    Use Alpha

    Go

    M

    Because you used the 2 part naming convention (a really good practice, BTW), it probably doesn't matter one bit except that it flies in the face of most best practices. It's a form of Hungarian Notation that's generally frowned on even if sp_ had no special meaning. It can also be a real PITA when you have a table that you need to rename and put a view with the former table name on. Nothing like having a view with the tbl_ prefix to confuse the hell out of people and it happens more than you might thing especially if the original table was poorly designed and needs to be fixed without breaking code.

    That, notwithstanding, if that's the mistake a given shop wants to have in their standards, I'll follow their standards but still warn them. And I always use the 2 part naming convention even if 3 or 4 parts are required. Synonyms and pass-through views make that possible. It's so I don't have to change code if they want to point to a different database or server.

    --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)
    Intro to Tally Tables and Functions

  • Tx,

    and how about my question, can be those ABC called simultaneously ?

  • No, they will run sequentially.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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