Solved

Built-in Function Determinism

Posted on 2010-08-13
5
547 Views
Last Modified: 2012-05-10
"You cannot influence the determinism of any built-in function. Each built-in function is deterministic or nondeterministic based on how the function is implemented by SQL Server.
For example:
The CAST function is deterministic unless used with datetime, smalldatetime, or sql_variant. "

Please, experts
could help me with transact sql code in order to make this example: The CAST function is deterministic unless used with datetime

0
Comment
Question by:enrique_aeo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 60

Accepted Solution

by:
Kevin Cross earned 75 total points
ID: 33431637
Is this for homework OR are you just wanting to know what an example :

select CAST(GETDATE() AS VARCHAR(20));

so many factors will go into how and what is displayed to you, versus you know what you are getting when you say:

select CAST(1 AS CHAR(1));
0
 
LVL 8

Assisted Solution

by:mustaccio
mustaccio earned 50 total points
ID: 33432259
A deterministic function always return the same result given the same input. A non-deterministic function may sometimes return a different result, given the same input. For example, a datetime formatted with the short (2-digit) year may change over time, depending on how the cut-off year is configured, or if that configuration changes.
0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 33432769
Welcome to Experts Exchange, @mustaccio! Well said.
0
 

Author Closing Comment

by:enrique_aeo
ID: 33432927
I am studing for certification
0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 33433157
Got you. Just figured if it is something like that you are going to want deeper explanation. Glad we could help.

Best regards,
Kevin
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question