Solved

Built-in Function Determinism

Posted on 2010-08-13
5
537 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 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Suggested Solutions

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…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

733 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