You can use the following code segment to replace dashes and commas. I suspect negative numbers may be shown using brackets, for example, -234 as (234). This takes care of that too:REPLACE( CASE WHEN datacolumn = '-' THEN '0' WHEN datacolumn LIKE '(%)' THEN REPLACE(REPLACE(datacolumn,'(','-'),')','') END, ',','')
So then you will need to replace each occurrence of datacolumn in your expression with the above.SUM( CASE WHEN ISNUMERIC( REPLACE( CASE WHEN datacolumn = '-' THEN '0' WHEN datacolumn LIKE '(%)' THEN REPLACE(REPLACE(datacolumn,'(','-'),')','') END, ',','')) = 1 THEN CAST( REPLACE( CASE WHEN datacolumn = '-' THEN '0' WHEN datacolumn LIKE '(%)' THEN REPLACE(REPLACE(datacolumn,'(','-'),')','') END, ',','') AS FLOAT) ELSE 0 END )
It gets ugly very fast, doesn't it. Many SQL experts would advise you to use the correct data type for the column, which then would force you insert only valid data. That would help in all sorts of things, including querying, avoiding costly and time-consuming mistakes and errors in the future etc.