title: Creating a calculated field for my simple SQL 2008 table
body: <p>Here's what the table looks like:</p>
  
  <pre><code>create table Shipping
  (
  ShippingId int primary key identity(1,1),
  ProductId int foreign key references Product(ProductId),
  LargoEnCm decimal(16,2),
  AltoEnCm decimal(16,2),
  AnchoEnCm decimal(16,2),
  PesoKg decimal(16,2),
  PesoVolumen decimal(16,2),
  PesoFacturable decimal(16,2),
  A decimal(16,2),
  B decimal(16,2),
  C decimal(16,2),
  D decimal(16,2),
  E decimal(16,2),
  F decimal(16,2),
  G decimal(16,2)
  )
  </code></pre>
  
  <p>For example, the field <code>PesoVolumen</code> should be a calculated field from this:</p>
  
  <pre><code>(LargoEnCm * AltoEnCm * AnchoEnCm) / 6000
  </code></pre>
  
  <p>How would I declare this calculation so that everytime someone enters the data in the rows this field is automatically populated?</p>
  
  <p>How about conditional statements? Does SQL support this?</p>
  
  <p>For example, in <code>PesoFacturable</code> the value of either <code>PesoKg</code> or <code>PesoVolumen</code> would go into it, depending on which is bigger. An If statement would solve this, can I write this directly in SQL?</p>