Error: Arithmetic overflow error converting expression to data type nvarchar.
UPDATE [dbo].ForecastAccuracyKeyAccounts
SET ThreeMonthPercent = ((Actual - ThreeMonthForecast) / Actual) * 100, SixMonthPercent = ((Actual - SixMonthForecast) / Actual) * 100,
NineMonthPercent = ((Actual - NineMonthForecast) / Actual) * 100
WHERE Actual != 0
Since, I am dividing by Actual, I want to ensure that Actual is not equal to zero. But when I add the statement in the WHERE CLAUSE I cannot get rid of the error.
WHEREbeforeSET)? If not, it could evaluate theSETstatements first before applying theWHEREclause. [In which case you'll need to test forActual=0somehow in yourSETstatement, e.g. .../NULLIF(Actual,0)]