Tuesday, 31 December 2024

Deterministic and Nondeterministic function in SQL Server

 

The terms deterministic and nondeterministic refer to the predictability of the results returned by functions, specifically when a function is called with the same set of inputs.

Deterministic Functions

A function is deterministic if it always returns the same result when called with the same input values, regardless of when or where it's called. Deterministic functions are predictable and do not depend on external factors like time or session state.

Examples of Deterministic Functions

Ø  Mathematical functions like ABS (), SQRT (), POWER (), etc.

Ø  String functions like UPPER (), LOWER (), LEN (), etc.

Ø  Logical functions like COALESCE()

Nondeterministic Functions

A function is nondeterministic if it may return different results even when called with the same input values. Nondeterministic functions depend on factors like the system time, session-specific data, or database state, which can vary between executions.

Examples of Nondeterministic Functions

Ø  GETDATE () or SYSDATETIME () - returns the current system date and time, which changes with each call.

Ø  NEWID () - generates a new unique identifier (GUID) each time it is called.

Ø  RAND () - generates a random number that can differ between calls.

Ø  System information functions like @@SPID (returns the current session ID)

7 comments:

  1. First of all, thanks for all the useful information. I appreciate your hard work. Keep posting new updates with us.

    DedicatedHosting4u.com can help you reach new heights with to online business with Dedicated Server , VPS and colocation.

    Offshore dedicated server
    Resell dedicated servers
    Cheapest dedicated hosting
    managed vs unmanaged server
    Reliable dedicated hosting
    secure dedicated server


    ReplyDelete
  2. Hello! I simply wish to supply a massive thumbs up for your wonderful information you might have here on this post. I am returning to your blog post for more soon. Music studio

    ReplyDelete
  3. Wonderful content! Your writing style is engaging, and I truly enjoyed this post. Thanks for sharing such valuable insights! Soccer Betting Software

    ReplyDelete
  4. First of all, thanks for all the useful information. I appreciate your hard work. Keep posting new updates with us.

    DedicatedHosting4u.com can help you reach new heights with to online business with Dedicated Server , VPS and colocation.

    Offshore dedicated server
    Resell dedicated servers
    Cheapest dedicated hosting
    managed vs unmanaged server
    Reliable dedicated hosting
    secure dedicated server


    ReplyDelete
  5. First of all, thanks for all the useful information. I appreciate your hard work. Keep posting new updates with us.

    DedicatedHosting4u.com can help you reach new heights with to online business with Dedicated Server , VPS and colocation.

    Offshore dedicated server
    Resell dedicated servers
    Cheapest dedicated hosting
    managed vs unmanaged server
    Reliable dedicated hosting
    secure dedicated server


    ReplyDelete
  6. Such a valuable post! You’ve provided a fresh perspective on a topic that many overlook. The way you structured your arguments and supported them with relevant details makes this an informative and enjoyable read. Keep up the amazing work—your writing is always a joy to follow! Best Poker Game Development Company

    ReplyDelete
  7. First of all, thanks for all the useful information. I appreciate your hard work. Keep posting new updates with us.

    DedicatedHosting4u.com can help you reach new heights with to online business with Dedicated Server , VPS and colocation.

    Offshore dedicated server
    Resell dedicated servers
    Cheapest dedicated hosting
    managed vs unmanaged server
    Reliable dedicated hosting
    secure dedicated server


    ReplyDelete

If you have any doubt, please let me know.

Popular Posts