News

Scalar functions let you encapsulate a calculation into a stored procedure-like snippet of SQL. It’s common practice to return the results of a scalar function as a column in a SELECT query.
FROM statement using source data that's known to have flaws. Back to the OP - either filter out the bad records in the WHERE clause, or put a CASE statement in the UPDATE list. No need for a cursor.