Solved

Built-in Function Determinism

Posted on 2010-08-13
5
529 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
  • 3
5 Comments
 
LVL 59

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 59

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 59

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 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