Results 1 to 3 of 3

Thread: 2 basic transaction issues

  1. #1
    Join Date
    Jan 2009
    Posts
    2

    2 basic transaction issues

    Hello everyone,

    Two basic questions about transactions in SQL Server 2005,

    1. For single SQL insert/update/delete statement, are there any needs or benefits to wrap into a transaction?

    2. I wrote T-SQL like this,

    Code:
    BEGIN TRY
    Begin Transaction
    ...
    commit
    END TRY
    BEGIN CATCH
    rollback
    ...
    END CATCH
    my question is, is it a must to call commit explicitly just before end try statement? Any means to commit transaction automatically after end try statement?

    regards,
    George

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    1. Don't need, single sql statement is a transaction.
    2. Yes, otherwise the transaction is still open.

  3. #3
    Join Date
    Jan 2009
    Posts
    2
    Cool, rmiao!

    Quote Originally Posted by rmiao View Post
    1. Don't need, single sql statement is a transaction.
    2. Yes, otherwise the transaction is still open.
    Question answered.

    regards,
    George

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •