title: SQL Server add computed column in VIEW with conditions
body: <p>Here is my situation:</p>
  
  <p>In my table i two fields:</p>
  
  <pre><code>- Price (decimal (15,4)
  - TaxId (int)
  </code></pre>
  
  <p><code>TaxId</code> value is not stored anywhere but there are only two values (actualy 3).</p>
  
  <pre><code>- 1 (8.5%)
  - 2 (20%)
  - NULL (no tax)
  </code></pre>
  
  <p>Now i need calculated column in my view that would calculate new price with tax included.</p>
  
  <p>Any idea?</p>
  
  <p>I went with something like:</p>
  
  <pre><code>SELECT...
  CASE TaxId
     WHEN 1 THEN Price *1.085 AS test
     WHEN 2 THEN Price *1.2 AS test
     WHEN NULL THEN Price  AS test END
  FROM...
  </code></pre>
  
  <p>UPDATE:</p>
  
  <p>I have managed to execute the query with success.</p>
  
  <pre><code>CASE dbo.Table.TaxId WHEN 1 THEN dbo.Table.Price*1.085 WHEN 2 THEN dbo.Table.Price*1.2 ELSE dbo.Table.Price END AS CalcualtedPrice
  </code></pre>
  
  <p>Now I only need to make CalculatedPrice as decimal (15,4). How can i set that?</p>