Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 493f91c

Browse files
authored
Add code to check for determinism
This article does a good job of describing determinism but lacks code that lets the reader determine whether or not a function is actually deterministic. I've added sample code to do that.
1 parent 5d64738 commit 493f91c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

docs/relational-databases/user-defined-functions/deterministic-and-nondeterministic-functions.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ Deterministic functions must be [schema-bound](user-defined-functions.md#SchemaB
2727

2828
This article identifies the determinism of built-in system functions and the effect on the deterministic property of user-defined functions when it contains a call to extended stored procedures.
2929

30+
### Determining if a function is deterministic
31+
32+
You can check whether or not a function is deterministic by checking the "is_deterministic" object property for the function. The example below determines if the function Sales.CalculateSalesTax is deterministic.
33+
34+
```sql
35+
SELECT OBJECTPROPERTY(OBJECT_ID('Sales.CalculateSalesTax'), 'IsDeterministic');
36+
```
37+
3038
## Built-in function determinism
3139

3240
You can't influence the determinism of any built-in function. Each built-in function is deterministic or nondeterministic based on how the function is implemented by [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. For example, specifying an ORDER BY clause in a query doesn't change the determinism of a function that is used in that query.

0 commit comments

Comments
 (0)