title: How to select and update selected rows in a single sql query?
body: <p>I have a table named <code>Car</code></p>
  
  <pre><code>Table car ( id int NOT NULL, plate int NOT NULL, sent_to_server bit NOT NULL ); 
  </code></pre>
  
  <p>I want to select all Cars which are not sent to server yet</p>
  
  <pre><code>SELECT * 
  FROM   car 
  WHERE  sent_to_server = 0; 
  </code></pre>
  
  <p>Then I should update my DB</p>
  
  <pre><code>UPDATE car 
  SET    sent_to_server = 1 
  WHERE  sent_to_server = 0; 
  </code></pre>
  
  <p>I have multiple threads so this wont work (multiple threads are reading and writing to the 
  database at the same time -(im using sql server))</p>
  
  <p>How can I execute 2 queries in One Query ?
  Or is there a better solution !?</p>
  
  <p>note: i'm using C# with petapoco library (if it matters !)</p>