?
Solved

Built-in Function Determinism

Posted on 2010-08-13
5
Medium Priority
?
559 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 300 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 200 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

How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

Question has a verified solution.

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

     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

762 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