• CirquedeSQLeil (2/18/2010)


    Saurabh Dwivedy (2/18/2010)


    Paul White (2/17/2010)


    With an exclusive lock, no other transactions can modify data (except for operations with NOLOCK hint or read uncommitted isolation level)

    What???!!! :w00t:

    I want my point back!

    Unless someone can post code or a reference to show that NOLOCK or READ UNCOMMITTED allows modification of data protected by an exclusive lock!

    Grrr!

    With an exclusive lock, no other transactions can modify data (read operations with NOLOCK hint or read uncommitted isolation level can take place),

    The above choice states clearly that no other transaction can MODIFY data - which is correct; that being said, Read operations with NOLOCK hint or under read uncommitted isolation level can certain take place - REFER to the following link ----- http://www.sqlteam.com/article/introduction-to-locking-in-sql-server (exclusive lock section)

    Exclusive locks prevent write access to a resource by concurrent transactions ,

    I don't think there is any ambiguity in this choice - it is clear enough and correct - X Locks prevents any concurrent write access

    Data modification statements typically request both shared locks and exclusive locks

    I must admit that I was momentarily confused by the wording of this choice - I only answered it from gut feel; Typically DML operations should take an UPDATE lock; While Shared locks can be escalated to an exclusive lock when the DML kicks in, it can end up in a deadlock if another transaction (under shared lock mode) attempts to update the same data. To prevent this situation Update locks are used. Saying that Data Modification statements typically REQUEST both shared and exclusive locks does lead to an ambiguous situation. It could have been more appropriately worded.

    The question originally stated (in essence) that a nolock hint could be used to modify while an exclusive lock was held. It has been changed since. Paul wasn't disputing that a read could happen while using the nolock hint if an exclusive lock was held - just that the wording was wrong and thus made that option incorrect.

    Thanks Cirque... it sounds like I joined the party late when the question had already been modified...

    Saurabh Dwivedy
    ___________________________________________________________

    My Blog: http://tinyurl.com/dwivedys

    For better, quicker answers, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537

    Be Happy!