title: multiply all float values of a column in table, If a value is null or negative or not numeric, raise an error in SQL server 2008 R2
body: <p>I need to multiply all float values of a column in table if the column value is positive.
  If I find a value is null or negative or not numeric, I raise an error in SQL server 2008 R2.</p>
  
  <p>given table t0: </p>
  
  <pre><code>   col
     1.5 
      2 
  </code></pre>
  
  <p>given table t1: </p>
  
  <pre><code>    col
       2
      -1
       5
       0
      null
      NaN
  </code></pre>
  
  <p>For t0 I should get 3, for t1, I should raise  an error. </p>
  
  <pre><code>  DECLARE @ta float
    SELECT CASE @float 
      when tableName.col &lt;= 0 then raiseError
      when tableName.factor IS NULL  then raiseError
      ELSE multiply(tableName.col)
      END
  FROM tableName
  </code></pre>
  
  <p>I know that I can use exp(sum(log(isnull()))) ,but, for floating point calculations, it is not efficient. Are there more efficient ways to do it ? </p>
  
  <p>Any help would be appreciated. </p>