title: What is the use of these keyword in sql server (UPDLOCK, ROWLOCK READPAST)
body: <p>i like to know what is the use of these keyword in sql server <code>(UPDLOCK, ROWLOCK READPAST)</code> and when to use it? i mean in what kind of situation people go for <code>(UPDLOCK, ROWLOCK READPAST)</code>.</p>
  
  <pre><code>1) select top 1 COMMAND
  from EXAMPLE_TABLE
  with (UPDLOCK, ROWLOCK)
  where PROCESSED=false;
  </code></pre>
  
  <p>just see the above sql they use <code>UPDLOCK</code>, <code>ROWLOCK</code> what is <code>UPDLOCK</code>, <code>ROWLOCK</code>?</p>
  
  <p>what will happen for <code>UPDLOCK</code>, <code>ROWLOCK</code> ?</p>
  
  <pre><code>2) SELECT TOP(1) COMMAND, PROCESSED
    FROM TABLE WITH (READPAST)
    WHERE PROCESSED = 0
  </code></pre>
  
  <p>what is <code>READPAST</code>? when we use <code>READPAST</code> then what happen ?</p>
  
  <pre><code>3) UPDATE  OrderTable WITH ( ROWLOCK )
      SET     ProcessorID = @PROCID
      WHERE   OrderID IN ( SELECT TOP ( 20 )
                                          OrderID
                                  FROM    OrderTable WITH ( ROWLOCK )
                                  WHERE   ProcessorID = 0)
  </code></pre>
  
  <p>here the above sql use <code>ROWLOCK</code> for update statement and also in nested select sub query......why??</p>
  
  <p>what will happen for <code>ROWLOCK</code> ?</p>
  
  <p>it is my request that please explain each point with lots of example in such way as a result i can understand the usage of those keyword. thanks</p>