Unexpected @@rowcount behavior inside an UDF in MS SQL 2019
Scalar udf inlining yet again, rather buggy
SELECT dbo.rowcount_test()
OPTION (USE HINT('DISABLE_TSQL_SCALAR_UDF_INLINING'));
This should be fixed now.
https://support.microsoft.com/en-us/help/4538581/fix-scalar-udf-inlining-issues-in-sql-server-2019
This cumulative update also blocks Inlining in the following scenarios:
- If the UDF references certain intrinsic functions (e.g. @@ROWCOUNT) that may alter the results when Inlined