title: SQL Update - Updating selected rows
body: <p>I am using SQL Server 2008</p>
  
  <p>I have a table named <code>MYTABLE</code> with two columns: <code>ID</code>, <code>STATUS</code></p>
  
  <p>I want to write a stored procedure that returns the records whose <code>STATUS</code> is 0. But this stored proc must update the <code>STATUS</code> of returned rows to 1. How can I do this selecting and updating operation in a single query?</p>