Function Determinism

All functions that exist in SQL Server are either deterministic or nondeterministic. The determinism of a function is defined by the data that is returned by the function. The following outlines the determinism of a function:

  • A function is considered deterministic if it always returns the same result set when it's called with the same set of input values.

  • A function is considered nondeterministic if it doesn't always return the same result every time it's called with the same set of input values .

This might sound somewhat complicated, but it really isn't. Take, for example, the DATEDIFF and GETDATE functions. DATEDIFF is deterministic because it will always return the same data every time it's run with the same input parameters. ...

Get Writing Stored Procedures for Microsoft SQL Server now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.