title: TryParse in a Sql Server computed column
body: <p>I need add a computed column to an SQL Server datatable to perfomrs a cast over another column in same table. Is there the best approach to achieve it or someone has a better idea?</p>
  
  <p>Important note: StringValue column has a 5% or less of non numeric values, they must be parsed as zero. </p>
  
  <pre><code>ALTER TABLE dbo.Tabla ADD
      ParsedValue AS case isnumeric(StringValue) when 1 then cast(StringValue as decimal(18,4)) else 0 end PERSISTED 
  GO
  </code></pre>
  
  <p>Thanks in advance,</p>