How to know a user defined function is deterministic?

  • How can I find out if SQL server has decided a user defined function I create is deterministic or not? Is there a function that will tell me? Can I find it by looking in sysobjects? Or some other view?

    The only way I know to get an idea of how the function has been clasified is by using it as a computed column and then checking the property of the column to see if the column is deterministic or not. And that is the whole point, I want the computed column to be deterministic.

    Robert W. Marda
    Billing and OSS Specialist - SQL Programmer
    MCL Systems

  • Check out "User-defined Function Design Guidelines" in Books Online.  Most imoprtantly they will be non-deterministic if they use call other functions that are non-deterministic or extended stored procedures.

    "Deterministic functions always return the same result any time they are called with a specific set of input values and given the same state of the database. "

     

  • This works in 2000, shouldn't be hard to tweak for 2k5.

     

    SELECT Name, OBJECTPROPERTY(id, 'IsDeterministic') AS isDeterministic FROM dbo.SysObjects WHERE XType = 'FN' ORDER BY OBJECTPROPERTY(id, 'IsDeterministic') DESC, Name

  • Thanks!

    Robert W. Marda
    Billing and OSS Specialist - SQL Programmer
    MCL Systems

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply