• IG (1/20/2012)


    Why not the following?

    SELECT a.EmployeeID,a.Salary a.RActive

    b.ManagerName

    FROM Employees a (nolock)

    ,Managers b (nolock)

    WHERE b.ManagerID = 1

    AND a.ManagerID = b.ManagerID;

    NOLOCK can return inconsistent data (dirty reads, non repeatable reads and the like), but can also return duplicate data or no data at all for some rows. NOLOCK means that data is not locked at all, even from the query itself, that could end up reading the same row twice in case of a page split.

    If you are ok with inconsistent data, then go on and use NOLOCK, just make sure your users are ok with inconsistent data as well.

    -- Gianluca Sartori