• pedro.ribeiro (3/30/2009)


    ok.

    Why does the GO (bacth breaker) brings more perfomance to que execution of the querys?

    It shouldn't. Have you tested and times it?

    If the first query fails and the second executes well, will the second query be automatically committed to the database? even if the first one as failed (and therefour not been committed to the database)?

    Yes. There's no reason it won't. There's no conditional logic to force a rollback

    In this case, if one of the two queries fail? will the other be committed to the database? for instance , suppose query one executes well, but query two fails.

    Would query one be committed to the database?

    Yes. Again you've got no conditional logic for force a rollback if either of the queries fail. Your code instructs SQL to begin a transaction, run two queries and then commit. If you want conditional rollback, you have to state it.

    http://sqlinthewild.co.za/index.php/2008/05/20/common-t-sql-mistakes/

    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