SQL Server Update Best Practices

Posted on 2010-01-08
Last Modified: 2013-12-14

I work on a case where a C# application receives Transactions and Transactions lines and then execute an update SP for both Transactions and TransactionLines. No validation are done and all Transaction Lines will be fully updated even if no changes happened. I feel it's not good at all, but C# developpers don't like to test every single fields to check if changes occured and then issue the Update anyways.

I know the answer to this question depends greatly on volume and size of the database and tables and how often you will save an update, but I would like to know general considerations and best practices on this.

Question by:lali_murray
    1 Comment
    LVL 25

    Accepted Solution

    Best practice: don't update what isn't changed.
    Better practice: don't even try to update what isn't changed
    => eliminates read's and locks

    So how do you do it? ex using a kind of modification-flag

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
    INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
    The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now