Options

Best practices for minimal table locking

clippernetclippernet Member Posts: 38
Hello Forum,

I would like to know if there are any hints or tips for code design which minimize impact on table availability. Do operations like MODIFY, INSERT place a lock on the whole table in a SQL Server database, even if the table is temporary? What about operations like SETRANGE and FIND? Where could I read about which operation results in what kind of locking behaviour?

What I want to do is to read through a range of sales headers and insert new records into a temporary sales header table if their sales lines meet some criteria - but this should not block other users from inserting into the sales header table at the same time, can this be done?

Thanks in advance,
Joe

Comments

  • Options
    matttraxmatttrax Member Posts: 2,309
    Search for Transactions in the forum and in the client help. That should get you started.
  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Hi

    Temporary table is a structure residing in local workstation memory only, so there are no transactions, no locks, and also no roll-backs when writing data to it;

    As for SQL locking - start from reading this

    Or better go directly to Waldo's blog.

    Regards,
    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Sign In or Register to comment.