title: How to insert the result in the desired row? SQL Server
body: <p>I need the result that I got to be inserted in the right row.</p>
  
  <pre><code>DECLARE @DiscPrice float;
  SET @DiscPrice = (SELECT Prod.priceProd - Prod.priceProd / 100 * Prod.disc 
                    FROM Prod 
                    WHERE id_prod = 1);
  
  UPDATE Prod 
  SET priceDisc = @DiscPrice 
  WHERE id_prod = 1;
  
  SELECT * FROM Prod;
  </code></pre>
  
  <p>That is, instead of <code>WHERE id_prod = 1</code>, there was something that inserted the desired result in all rows.</p>
  
  <p>I'm not sure I made myself clear, but I hope that you will understand.</p>