Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003
    Location
    London, England
    Posts
    106

    Unanswered: Transactions or not?

    I'm using stored procedures quite alot and I'm wondering what is best, to set the transactions myself or to let the sql-server handle tha transactions for me. I really don't know too much about this, but it seems like the sql-server handles it quite well. I'm soon about to put this app into production and I'm not really sure what to do...
    Frettmaestro
    "Real programmers don't document, if it was hard to write it should be hard to understand!"

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    SQL server will handle nearly all of your transaction. Generally the only time you want to handle this yourself is when you have updates to multiple tables and an error along the way would warrant undoing all prior updates.
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Jan 2003
    Location
    London, England
    Posts
    106
    Even with really "sensitive" data (money)? And when you say "updating multiple tables" does that mean at the same time or within the same procedure? Some of my procedures are really long and do alot of stuff...if I get an error in the end of one of them, will it roll back the entire procedure?
    Frettmaestro
    "Real programmers don't document, if it was hard to write it should be hard to understand!"

  4. #4
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    Not sure what you mean by sensitive data.

    When I say multiple tables I mean 2 + tables modified via seperate statments.

    Yes, you can wrap several of your statments in a begin & commit/rollback statment to undo work when some step has failed.

    I would suggest reading about transactions in Books Online. It is a bit of reading to get through but would provide a common point to talk from.
    Paul Young
    (Knowledge is power! Get some!)

Posting Permissions

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