Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Where do you put your transaction code?

Where do you put your transaction code?

Scheduled Pinned Locked Moved Database
questiondatabaseannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MY1201
    wrote on last edited by
    #1

    Hey guys. A little question on transaction best practices: 1. Where do you put your transaction control code? I mean: Do you put it in the code (try catch rollback()), or do you put it in the stored procedure? 2. Do you use transactions for simple insert, delete, update sentences? Best Regards Soeren

    C 1 Reply Last reply
    0
    • M MY1201

      Hey guys. A little question on transaction best practices: 1. Where do you put your transaction control code? I mean: Do you put it in the code (try catch rollback()), or do you put it in the stored procedure? 2. Do you use transactions for simple insert, delete, update sentences? Best Regards Soeren

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Bad Robot wrote:

      1. Where do you put your transaction control code? I mean: Do you put it in the code (try catch rollback()), or do you put it in the stored procedure?

      Stored Procedure usually, but sometimes I'll need to do several things in sequence so I'll managet the transaction in .NET

      Bad Robot wrote:

      2. Do you use transactions for simple insert, delete, update sentences?

      If it is a simple oneliner then no because SQL Server, by default, will automatically put that in a transaction for me.


      Upcoming Scottish Developers events: * UK Security Evangelists On Tour (2nd November, Edinburgh) * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups