• pedro.ribeiro (3/30/2009)


    In this case, will the second query starts executing only, when the first one have already finished to execute?

    yes

    Or first it’s executed the first query and only then, will be executed the second query?

    Yes

    SQL executes statements one by one in sequence, just like virtually any other language out there.

    I know that if one of the querys fail, in this case, none of the querys will be executed. Correct?

    No. There isn't sufficient error handling in there for that. The @@Error is only checking the error code of the second query. If the first throws an error, you'll never know about it

    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