SQL SERVER – Function Property – Deterministic or Non-Deterministic

I recently received question through email that how to determine if any user defined function is deterministic or non-deterministic?

First go through two articles I have written about deterministic and non-deterministic function.

SQL SERVER – Deterministic Functions and Nondeterministic Functions

SQL SERVER – 2005 – Use of Non-deterministic Function in UDF – Find Day Difference Between Any Date and Today

You can run following code to determine if function is deterministic or not.

SELECT
OBJECTPROPERTY(OBJECT_ID('dbo.ufnGetAccountingStartDate'),
'IsDeterministic'
) IsFunctionDeterministic

Reference : Pinal Dave (http://blog.SQLAuthority.com)

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s