title: sql how to select and update at the same time
body: <p>I have a table that has a column <code>processed</code> it is value is zero for failure and 1 for success. I want to add a third temporary case, its value is 2.</p>
  
  <p>my previous query is:</p>
  
  <pre><code>string query = "SELECT * FROM dbo.tableName WHERE processed = @processed";
  </code></pre>
  
  <p>I would like to do update for the rows that this selects makes. I can do that from .net of course, but I want to know if there is one query that can select the rows and update the process column at the same time.</p>
  
  <p>i am working with sql server 2008</p>
  
  <p>That question states a very old solution, which is the output, and I couldn't discover it my self. </p>