Monday, August 8, 2011

Functions in SQL Server 2008

A function performs operation on a given set of values and return a value. In Sql server, built in functions are either deterministic or non-deterministic.

Deterministic Functions:
A function is said to be deterministic if it returns same result at any time it is called for a specific set of input values.
DATEADD is a built-in deterministic function, as it returns the same value, when ever it is run on a specific set of values.

Non Deterministic Functions:
If a function returns different values each time it is called then it is said to non deterministic function.
GETDATE is a non deterministic function, as each time it is called it returns a different value. Date part returned by this function might be same but time part keeps changing for each call.

0 comments:

Post a Comment