Rules for Invoking a Scalar UDF From a MERGE Request
You can invoke a scalar UDF from the following clauses of a MERGE request.
You can invoke a scalar UDF from the USING SELECT clause of a MERGE request.
The rules for this invocation are the same as those for a standalone SELECT request (see “Invoking a Scalar UDF From a SELECT Statement” on page 19.
You can invoke a scalar UDF from the ON clause of a MERGE request as a secondary condition if it is invoked within an expression within the specified search condition or in the primary condition when it is bound to the primary index.
The other rules that are applicable to the ON clause of a SELECT request are applicable to the ON clause of a MERGE request. See “SELECT” on page 8 and “Chapter 2 Join Expressions.”
You can invoke a scalar UDF from the right-hand side of the SET clause in an UPDATE request as long as the UDF always return a value expression.
You can invoke a scalar UDF from the VALUES clause of the INSERT specification of a MERGE request.
The rules for specifying a scalar UDF in the VALUES clause of an INSERT specification are as follows: