locking mechanism of SQL server 2005

  • HI All,

    If any one help me on locking mechanism of SQl server .

    1.How to find the type of locking on a particular table or database ?

    2. What is the default type of locking ?[row , page, table, database...]??

    3.If any possiblity we can change the locking from one type to another ??

    Thanks

    Lavanya

  • ROWLOCK

    Use row-level locks when reading or modifying data.

    PAGLOCK

    Use page-level locks when reading or modifying data.

    TABLOCK

    Use a table lock when reading or modifying data.

    DBLOCK

    Use a database lock when reading or modifying data.

    UPDLOCK

    UPDLOCK reads data without blocking other readers, and update it later with the assurance that the data has not changed since last read.

    XLOCK

    Use exclusive locks instead of shared locks while reading a table, and use hold locks until the end of the statement or transaction.

    HOLDLOCK

    Use a hold lock to hold a lock until completion of the transaction, instead of releasing the lock as soon as the required table, row, or data page is no longer required.

    NOLOCK

    This does not lock any object. This is the default for SELECT operations. It does not apply to INSERT, UPDATE, and DELETE statements.

    More on http://blog.sqlauthority.com/2007/04/27/sql-server-2005-locking-hints-and-examples/

  • Lavanyasri (12/13/2011)


    HI All,

    If any one help me on locking mechanism of SQl server .

    1.How to find the type of locking on a particular table or database ?

    2. What is the default type of locking ?[row , page, table, database...]??

    3.If any possiblity we can change the locking from one type to another ??

    Thanks

    Lavanya

    Google is the bettter answer for you. Locking is a whole chapter of SQL Server. For understanding it better go to:

    http://msdn.microsoft.com/en-us/library/ms175519.aspx


    Sujeet Singh

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply