UPDATE TableA
SET Value = a.Value * b.AnotherValue
FROM TableA AS a
INNER JOIN TableB AS b
WHERE (Condition is true);
Here is the problem. The Value field for TableA does not allow nulls. If the calculation of a.Value * b.AnotherValue yields a null, an error is thrown. Now the question. Is there any way to tell the UPDATE to ignore the SET phase when the result of the calculation is a null and delete the record rather than updating it. This UPDATE is intended to update hundreds of records at a time but will fail if a single null is encountered. Also, please note that using the ISNULL() function and setting the Value to zero is not acceptable. I would like the record to be dropped if a null is encountered. Many thanks in advance for any help rendered.
Assuming you mean leave the value unchanged when nulls are encountered by “I would like the record to be dropped if a null is encountered.”
If you actually want to delete the rows and are using SQL 2008 or later, try the merge statement.