• sqlenthu 89358 (8/24/2016)


    Sergiy (8/23/2016)


    sqlenthu 89358 (8/21/2016)


    sp_executesql works in sequential order only.

    I wonder - where does it come from?

    Does it work parallel as well ? I mean if I write it as follows:

    sp_executesql <some proc1>

    sp_executesql <some proc2>

    then will it just fire proc1 first and then before it's completion fire proc2 ? No, I believe.

    It has nothing to do with sp_executesql.

    In your script statements are executed sequentially one after another.

    Any kind of statements.

    And I believe it's true for any kind of script, not only T-SQL.

    If you want Proc1 and Proc2 to be executed at the same time launch them from independent command shells:

    - different SSMS windows;

    - different command prompt sessions;

    - different SQL Agent jobs;

    - different SSIS tasks;

    - etc.

    But - you probably do not need any of those options.

    SQL Server has its own parallelism.

    It will perform your single query in several parallel threads if it decides that performance will benefit from parallel execution.

    _____________
    Code for TallyGenerator