Conditional Case Construct in SQL
Posted on 2009-02-17
I am attempting to use a CASE construct to cast a column value as a decimal after checking to see if it is numeric.
Syntax is similar to Case isnumeric(tabval)= 1 and .. then cast(tabval) as decimal(19,4) else CASE when isnumeric(tabValue)=0 then tabvalue end
Obtain Error converting data type varchar to numeric error message when tabvalue is not numeric.
I have tried several variations of the statement in the code samples, but all result with the same error.