Skip to content

Commit 78576f2

Browse files
20211644 update greatest and least
1 parent 282c564 commit 78576f2

6 files changed

Lines changed: 60 additions & 27 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
author: WilliamDAssafMSFT
3+
ms.service: sql
4+
ms.topic: include
5+
ms.date: 04/09/2021
6+
ms.author: wiassaf
7+
---
8+
9+
<Token>![yes](../media/yes-icon.png)[!INCLUDE [ssazuresynapse_sqlpool_only](../ssazuresynapse_sqlpool_only.md)]</Token>
10+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
author: WilliamDAssafMSFT
3+
ms.service: sql
4+
ms.topic: include
5+
ms.date: 04/09/2021
6+
ms.author: wiassaf
7+
---
8+
9+
[!INCLUDE [Applies to](../../includes/applies-md.md)] [!INCLUDE [Azure SQL Database](../../includes/applies-to-version/_asdb.md)] [!INCLUDE [SQL Managed Instance](../../includes/applies-to-version/_asdbmi.md)] [!INCLUDE [Azure Synapse Analytics (serverless SQL pool only)](../../includes/applies-to-version/_asa-sqlpool-only.md)] [!INCLUDE [Parallel Data Warehouse](../../includes/applies-to-version/_pdw.md)]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
author: WilliamDAssafMSFT
3+
ms.service: sql
4+
ms.topic: include
5+
ms.date: 04/09/2021
6+
ms.author: wiassaf
7+
---
8+
9+
Azure Synapse Analytics (serverless SQL pool only)

docs/t-sql/functions/logical-functions-greatest-transact-sql.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: "Logical Functions - GREATEST (Transact-SQL)"
3-
title: "GREATEST (Transact-SQL) | Microsoft Docs"
3+
title: "GREATEST (Transact-SQL)"
44
ms.custom: ""
55
ms.date: "04/09/2021"
66
ms.prod: sql
@@ -15,16 +15,17 @@ dev_langs:
1515
- "TSQL"
1616
helpviewer_keywords:
1717
- "GREATEST function"
18-
ms.assetid: 1c382c83-7500-4bae-bbdc-c1dbebd3d83f
1918
author: jmsteen
2019
ms.author: josteen
20+
ms.reviewer: wiassaf
2121
---
2222
# Logical Functions - GREATEST (Transact-SQL)
23-
[!INCLUDE [SQL Server Azure SQL Database ](../../includes/applies-to-version/sql-asdb.md)]
24-
25-
**_NOTE:_** GREATEST is currently available for Azure SQL Database, Azure SQL Managed Instance and serverless SQL pools in Azure Synapse Analytics.
23+
[!INCLUDE [sql-asdb-asdbmi-asa-svrless-poolonly](../../includes/applies-to-version/sql-asdb-asdbmi-asa-svrless-poolonly.md)]
2624

2725
This function returns the maximum value from a list of one or more expressions.
26+
27+
> [!Note]
28+
> `GREATEST` is currently available for [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)], [!INCLUDE[ssazuremi_md](../../includes/ssazuremi_md.md)], and serverless SQL pools in [!INCLUDE[ssazuresynapse_md](../../includes/ssazuresynapse_md.md)].
2829
2930
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
3031

@@ -38,7 +39,7 @@ GREATEST ( expression1 [ ,...expressionN ] )
3839
*expression1, expressionN*
3940
A list of comma-separated expressions of any comparable data type. The `GREATEST` function requires at least one argument and supports no more than 254 arguments.
4041

41-
Each expression can be a constant, variable, column name or function, as well as any combination of arithmetic, bitwise and string operators. Aggregate functions and scalar subqueries are permitted.
42+
Each expression can be a constant, variable, column name or function, and any combination of arithmetic, bitwise, and string operators. Aggregate functions and scalar subqueries are permitted.
4243

4344
## Return Types
4445
Returns the data type with the highest precedence from the set of types passed to the function. For more information, see [Data Type Precedence &#40;Transact-SQL&#41;](../../t-sql/data-types/data-type-precedence-transact-sql.md).
@@ -56,15 +57,15 @@ GREATEST ( expression1 [ ,...expressionN ] )
5657

5758
If implicit type conversion between the arguments is not supported, the function will fail and return an error.
5859

59-
See [Data Type Conversion &#40;Database Engine&#41;](../../t-sql/data-types/data-type-conversion-database-engine.md) for further details on implicit and explicit conversion.
60+
For more information on implicit and explicit conversion, see [Data Type Conversion &#40;Database Engine&#41;](../../t-sql/data-types/data-type-conversion-database-engine.md).
6061

61-
If one or more arguments are not null, then null arguments will be ignored during comparison. If all arguments are null, then `GREATEST` will return null.
62+
If one or more arguments are not `NULL`, then `NULL` arguments will be ignored during comparison. If all arguments are `NULL`, then `GREATEST` will return `NULL`.
6263

6364
Comparison of character arguments follows the rules of [Collation Precedence &#40;Transact-SQL&#41;](../../t-sql/statements/collation-precedence-transact-sql.md).
6465

65-
The following types are **not** supported for comparison in `GREATEST`: **varchar(max), varbinary(max) or nvarchar(max) exceeding 8,000 bytes, cursor, geometry, geography, image, non-byte-ordered user-defined types, ntext, table, text** and **xml**.
66+
The following types are **not** supported for comparison in `GREATEST`: **varchar(max), varbinary(max) or nvarchar(max) exceeding 8,000 bytes, cursor, geometry, geography, image, non-byte-ordered user-defined types, ntext, table, text**, and **xml**.
6667

67-
The varchar(max), varbinary(max) and nvarchar(max) data types are supported for arguments that are 8,000 bytes or below, and will be implicitly converted to varchar(n), varbinary(n) and nvarchar(n), respectively, prior to comparison.
68+
The varchar(max), varbinary(max), and nvarchar(max) data types are supported for arguments that are 8,000 bytes or below, and will be implicitly converted to varchar(n), varbinary(n), and nvarchar(n), respectively, prior to comparison.
6869

6970
For example, varchar(max) can support up to 8,000 characters if using a single-byte encoding character set, and nvarchar(max) can support up to 4,000 byte-pairs (assuming UTF-16 character encoding).
7071

@@ -74,7 +75,7 @@ GREATEST ( expression1 [ ,...expressionN ] )
7475

7576
The following example returns the maximum value from the list of constants that is provided.
7677

77-
The scale of the return type is determined by that of the argument with the highest precedence data type.
78+
The scale of the return type is determined by the scale of the argument with the highest precedence data type.
7879

7980
```sql
8081
SELECT GREATEST ( '6.62', 3.1415, N'7' ) AS Greatest;
@@ -180,9 +181,9 @@ Var2 .825
180181
(1 rows affected)
181182
```
182183

183-
### E. Using `GREATEST` with columns, constants and variables
184+
### E. Using `GREATEST` with columns, constants, and variables
184185

185-
This example uses `GREATEST` to determine the maximum value of a list that includes columns, constants and variables.
186+
This example uses `GREATEST` to determine the maximum value of a list that includes columns, constants, and variables.
186187

187188
```sql
188189
CREATE TABLE products (

docs/t-sql/functions/logical-functions-least-transact-sql.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
---
22
description: "Logical Functions - LEAST (Transact-SQL)"
3-
title: "LEAST (Transact-SQL) | Microsoft Docs"
3+
title: "LEAST (Transact-SQL)"
44
ms.custom: ""
55
ms.date: "04/09/2021"
66
ms.prod: sql
77
ms.prod_service: "database-engine, sql-database"
8-
ms.reviewer: ""
98
ms.technology: t-sql
109
ms.topic: reference
1110
f1_keywords:
@@ -15,16 +14,17 @@ dev_langs:
1514
- "TSQL"
1615
helpviewer_keywords:
1716
- "LEAST function"
18-
ms.assetid: 1c382c83-7500-4bae-bbdc-c1dbebd3d83f
1917
author: jmsteen
2018
ms.author: josteen
19+
ms.reviewer: wiassaf
2120
---
2221
# Logical Functions - LEAST (Transact-SQL)
23-
[!INCLUDE [SQL Server Azure SQL Database ](../../includes/applies-to-version/sql-asdb.md)]
24-
25-
**_NOTE:_** LEAST is currently available for Azure SQL Database, Azure SQL Managed Instance and serverless SQL pools in Azure Synapse Analytics.
22+
[!INCLUDE [sql-asdb-asdbmi-asa-svrless-poolonly](../../includes/applies-to-version/sql-asdb-asdbmi-asa-svrless-poolonly.md)]
2623

2724
This function returns the minimum value from a list of one or more expressions.
25+
26+
> [!Note]
27+
> `LEAST` is currently available for [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)], [!INCLUDE[ssazuremi_md](../../includes/ssazuremi_md.md)], and serverless SQL pools in [!INCLUDE[ssazuresynapse_md](../../includes/ssazuresynapse_md.md)].
2828
2929
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
3030

@@ -38,7 +38,7 @@ LEAST ( expression1 [ ,...expressionN ] )
3838
*expression1, expressionN*
3939
A list of comma-separated expressions of any comparable data type. The `LEAST` function requires at least one argument and supports no more than 254 arguments.
4040

41-
Each expression can be a constant, variable, column name or function, as well as any combination of arithmetic, bitwise and string operators. Aggregate functions and scalar subqueries are permitted.
41+
Each expression can be a constant, variable, column name or function, and any combination of arithmetic, bitwise, and string operators. Aggregate functions and scalar subqueries are permitted.
4242

4343
## Return Types
4444
Returns the data type with the highest precedence from the set of types passed to the function. For more information, see [Data Type Precedence &#40;Transact-SQL&#41;](../../t-sql/data-types/data-type-precedence-transact-sql.md).
@@ -56,15 +56,15 @@ LEAST ( expression1 [ ,...expressionN ] )
5656

5757
If implicit type conversion between the arguments is not supported, the function will fail and return an error.
5858

59-
See [Data Type Conversion &#40;Database Engine&#41;](../../t-sql/data-types/data-type-conversion-database-engine.md) for further details on implicit and explicit conversion.
59+
For more information on implicit and explicit conversion, see [Data Type Conversion &#40;Database Engine&#41;](../../t-sql/data-types/data-type-conversion-database-engine.md).
6060

61-
If one or more arguments are not null, then null arguments will be ignored during comparison. If all arguments are null, then `LEAST` will return null.
61+
If one or more arguments are not `NULL`, then `NULL` arguments will be ignored during comparison. If all arguments are `NULL`, then `LEAST` will return `NULL`.
6262

6363
Comparison of character arguments follows the rules of [Collation Precedence &#40;Transact-SQL&#41;](../../t-sql/statements/collation-precedence-transact-sql.md).
6464

65-
The following types are **not** supported for comparison in `LEAST`: **varchar(max), varbinary(max) or nvarchar(max) exceeding 8,000 bytes, cursor, geometry, geography, image, non-byte-ordered user-defined types, ntext, table, text** and **xml**.
65+
The following types are **not** supported for comparison in `LEAST`: **varchar(max), varbinary(max) or nvarchar(max) exceeding 8,000 bytes, cursor, geometry, geography, image, non-byte-ordered user-defined types, ntext, table, text**, and **xml**.
6666

67-
The varchar(max), varbinary(max) and nvarchar(max) data types are supported for arguments that are 8,000 bytes or below, and will be implicitly converted to varchar(n), varbinary(n) and nvarchar(n), respectively, prior to comparison.
67+
The varchar(max), varbinary(max), and nvarchar(max) data types are supported for arguments that are 8,000 bytes or below, and will be implicitly converted to varchar(n), varbinary(n), and nvarchar(n), respectively, prior to comparison.
6868

6969
For example, varchar(max) can support up to 8,000 characters if using a single-byte encoding character set, and nvarchar(max) can support up to 4,000 byte-pairs (assuming UTF-16 character encoding).
7070

@@ -74,7 +74,7 @@ LEAST ( expression1 [ ,...expressionN ] )
7474

7575
The following example returns the minimum value from the list of constants that is provided.
7676

77-
The scale of the return type is determined by that of the argument with the highest precedence data type.
77+
The scale of the return type is determined by the scale of the argument with the highest precedence data type.
7878

7979
```sql
8080
SELECT LEAST ( '6.62', 3.1415, N'7' ) AS Least;
@@ -180,9 +180,9 @@ Var3 .610
180180
(2 rows affected)
181181
```
182182

183-
### E. Using `LEAST` with columns, constants and variables
183+
### E. Using `LEAST` with columns, constants, and variables
184184

185-
This example uses `LEAST` to determine the minimum value of a list that includes columns, constants and variables.
185+
This example uses `LEAST` to determine the minimum value of a list that includes columns, constants, and variables.
186186

187187
```sql
188188
CREATE TABLE products (

docs/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15938,8 +15938,12 @@ items:
1593815938
items:
1593915939
- name: CHOOSE
1594015940
href: t-sql/functions/logical-functions-choose-transact-sql.md
15941+
- name: GREATEST
15942+
href: t-sql/functions/logical-functions-greatest-transact-sql.md
1594115943
- name: IIF
1594215944
href: t-sql/functions/logical-functions-iif-transact-sql.md
15945+
- name: LEAST
15946+
href: t-sql/functions/logical-functions-least-transact-sql.md
1594315947
- name: Metadata
1594415948
href: t-sql/functions/metadata-functions-transact-sql.md
1594515949
items:

0 commit comments

Comments
 (0)