Skip to content

Commit 699f91b

Browse files
authored
Merge pull request #33947 from MicrosoftDocs/main
4/28/2025 PM Publish
2 parents d1cf289 + edf71f9 commit 699f91b

File tree

5 files changed

+62
-26
lines changed

5 files changed

+62
-26
lines changed

azure-sql/database/active-geo-replication-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ For information about failover groups, review [scale a replica in a failover gro
174174

175175
## Prevent loss of critical data
176176

177-
Due to the high latency of wide area networks, geo-replication uses an asynchronous replication mechanism. Asynchronous replication makes the possibility of data loss unavoidable if the primary fails. To protect critical transactions from data loss, an application developer can call the [sp_wait_for_database_copy_sync](/sql/relational-databases/system-stored-procedures/sp-wait-for-database-copy-sync-transact-sql) stored procedure immediately after committing the transaction. Calling `sp_wait_for_database_copy_sync` blocks the calling thread until the last committed transaction has been transmitted and hardened in the transaction log of the secondary database. However, it doesn't wait for the transmitted transactions to be replayed (redone) on the secondary. `sp_wait_for_database_copy_sync` is scoped to a specific geo-replication link. Any user with the connection rights to the primary database can call this procedure.
177+
Due to the high latency of wide area networks, geo-replication uses an asynchronous replication mechanism. Asynchronous replication makes the possibility of data loss unavoidable if the primary fails. To protect critical transactions from data loss, an application developer can call the [sp_wait_for_database_copy_sync](/sql/relational-databases/system-stored-procedures/sp-wait-for-database-copy-sync-transact-sql) stored procedure immediately after committing the transaction. Calling `sp_wait_for_database_copy_sync` blocks the calling thread until the last committed transaction has been transmitted and hardened in the transaction log of the secondary database. It also waits for the transmitted transactions to be replayed (redone) on the secondary. `sp_wait_for_database_copy_sync` is scoped to a specific geo-replication link. Any user with the connection rights to the primary database can call this procedure.
178178

179179
> [!NOTE]
180180
> `sp_wait_for_database_copy_sync` prevents data loss after geo-failover for specific transactions, but does not guarantee full synchronization for read access. The delay caused by a `sp_wait_for_database_copy_sync` procedure call can be significant and depends on the size of the not yet transmitted transaction log on the primary at the time of the call.

azure-sql/database/high-availability-sla-local-zone-redundancy.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn about the architecture of Azure SQL Database that achieves av
55
author: WilliamDAssafMSFT
66
ms.author: wiassaf
77
ms.reviewer: rsetlem, mathoma, randolphwest
8-
ms.date: 03/26/2025
8+
ms.date: 04/28/2025
99
ms.service: azure-sql-database
1010
ms.subservice: high-availability
1111
ms.topic: conceptual
@@ -138,7 +138,6 @@ The zone-redundant version of the high availability architecture for the General
138138

139139
- All Azure regions that have [Availability zone support](/azure/reliability/regions-list) support zone redundant General databases.
140140
- For zone redundant availability, choosing a [maintenance window](maintenance-window.md) other than the default is currently available in select regions. For more information, see [Maintenance window availability by region for Azure SQL Database](region-availability.md#maintenance-window-availability).
141-
- Zone-redundant configuration is only available in SQL Database when standard-series (Gen5) hardware is selected.
142141
- Zone-redundancy isn't available for Basic and Standard service tiers in the DTU purchasing model.
143142

144143
### <a id="premium-and-business-critical-service-tier-zone-redundant-availability"></a> Premium and Business Critical service tiers

docs/t-sql/statements/set-ansi-nulls-transact-sql.md

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
---
22
title: "SET ANSI_NULLS (Transact-SQL)"
3-
description: SET ANSI_NULLS (Transact-SQL)
3+
description: SET ANSI_NULLS configures the behavior of the ANSI NULLS setting for equals and not equals comparison operators.
44
author: WilliamDAssafMSFT
55
ms.author: wiassaf
6-
ms.date: 04/04/2024
6+
ms.date: 04/28/2025
7+
ms.reviewer: jovanpop, randolphwest
78
ms.service: sql
89
ms.subservice: t-sql
910
ms.topic: reference
@@ -26,10 +27,12 @@ monikerRange: ">=aps-pdw-2016||=azure-sqldw-latest||>=sql-server-2016||>=sql-ser
2627
# SET ANSI_NULLS (Transact-SQL)
2728
[!INCLUDE [sql-asdb-asdbmi-asa-pdw](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw.md)]
2829

29-
Specifies ISO compliant behavior of the Equals (`=`) and Not Equal To (`<>`) comparison operators when they are used with null values in [!INCLUDE [ssnoversion](../../includes/ssnoversion-md.md)].
30+
Specifies ISO compliant behavior of the Equals (`=`) and Not Equal To (`<>`) comparison operators when they are used with `NULL` values in [!INCLUDE [ssnoversion](../../includes/ssnoversion-md.md)].
31+
- `SET ANSI_NULLS ON` - Evaluates both `{expression} = NULL` and `{expression} <> NULL` as `False` if the value of `{expression}` is `NULL`. This behavior is ANSI-compliant.
32+
- `SET ANSI_NULLS OFF` - Evaluates `{expression} = NULL` as `True` and `{expression} <> NULL` as `False` if the value of `{expression}` is `NULL`. This behavior is not recommended, because the `NULL` values should not be compared using `=` and `<>` operators.
3033

3134
> [!NOTE]
32-
> `SET ANSI_NULLS OFF` and the ANSI_NULLS OFF database option are deprecated. Starting with [!INCLUDE [_ss2017](../../includes/sssql17-md.md)], ANSI_NULLS is always set to ON. Deprecated features shouldn't be used in new applications. For more information, see [Deprecated Database Engine features in SQL Server 2017](../../database-engine/deprecated-database-engine-features-in-sql-server-2017.md#transact-sql-1).
35+
> `SET ANSI_NULLS OFF` and the `ANSI_NULLS OFF` database option are deprecated. Starting with [!INCLUDE [_ss2017](../../includes/sssql17-md.md)], ANSI_NULLS is always set to ON. Deprecated features shouldn't be used in new applications. For more information, see [Deprecated Database Engine features in SQL Server 2017](../../database-engine/deprecated-database-engine-features-in-sql-server-2017.md#transact-sql-1).
3336
3437
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: [Transact-SQL syntax conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
3538

@@ -49,13 +52,13 @@ SET ANSI_NULLS ON
4952

5053
## Remarks
5154

52-
When ANSI_NULLS is ON, a SELECT statement that uses `WHERE column_name = NULL` returns zero rows even if there are NULL values in *column_name*. A SELECT statement that uses `WHERE column_name <> NULL` returns zero rows even if there are non-NULL values in *column_name*.
55+
When `ANSI_NULLS` is ON, a `SELECT` statement that uses `WHERE column_name = NULL` returns zero rows even if there are NULL values in *column_name*. A `SELECT` statement that uses `WHERE column_name <> NULL` returns zero rows even if there are non-NULL values in *column_name*.
5356

54-
When ANSI_NULLS is OFF, the Equals (`=`) and Not Equal To (`<>`) comparison operators do not follow the ISO standard. A SELECT statement that uses `WHERE column_name = NULL` returns the rows that have null values in *column_name*. A SELECT statement that uses `WHERE column_name <> NULL` returns the rows that have non-NULL values in the column. Also, a SELECT statement that uses `WHERE column_name <> XYZ_value` returns all rows that are not *XYZ_value* and that are not NULL.
57+
When ANSI_NULLS is OFF, the Equals (`=`) and Not Equal To (`<>`) comparison operators do not follow the ISO standard. A `SELECT` statement that uses `WHERE column_name = NULL` returns the rows that have null values in *column_name*. A `SELECT` statement that uses `WHERE column_name <> NULL` returns the rows that have non-`NULL` values in the column. Also, a `SELECT` statement that uses `WHERE column_name <> XYZ_value` returns all rows that are not *XYZ_value* and that are not `NULL`.
5558

56-
When ANSI_NULLS is ON, all comparisons against a null value evaluate to UNKNOWN. When SET ANSI_NULLS is OFF, comparisons of all data against a null value evaluate to TRUE if the data value is NULL. If SET ANSI_NULLS is not specified, the setting of the ANSI_NULLS option of the current database applies. For more information about the ANSI_NULLS database option, see [ALTER DATABASE (Transact-SQL)](../../t-sql/statements/alter-database-transact-sql.md).
59+
When `ANSI_NULLS` is ON, all comparisons against a null value evaluate to UNKNOWN. When `SET ANSI_NULLS` is OFF, comparisons of all data against a null value evaluate to TRUE if the data value is `NULL`. If `SET ANSI_NULLS` is not specified, the setting of the `ANSI_NULLS` option of the current database applies. For more information about the `ANSI_NULLS` database option, see [ALTER DATABASE (Transact-SQL)](../../t-sql/statements/alter-database-transact-sql.md).
5760

58-
The following table shows how the setting of ANSI_NULLS affects the results of a number of Boolean expressions using null and non-null values.
61+
The following table shows how the setting of `ANSI_NULLS` affects the results of Boolean expressions using null and non-null values.
5962

6063
|Boolean Expression|**SET ANSI_NULLS ON**|**SET ANSI_NULLS OFF**|
6164
|---------------|---------------|------------|
@@ -70,22 +73,22 @@ The following table shows how the setting of ANSI_NULLS affects the results of a
7073
| `NULL IS NOT NULL` |FALSE|FALSE|
7174
| `1 IS NOT NULL` |TRUE|TRUE|
7275

73-
SET ANSI_NULLS ON affects a comparison only if one of the operands of the comparison is either a variable that is NULL or a literal NULL. If both sides of the comparison are columns or compound expressions, the setting does not affect the comparison.
76+
`SET ANSI_NULLS ON` affects a comparison only if one of the operands of the comparison is either a variable that is `NULL` or a literal `NULL`. If both sides of the comparison are columns or compound expressions, the setting does not affect the comparison.
7477

75-
For a script to work as intended, regardless of the ANSI_NULLS database option or the setting of SET ANSI_NULLS, use IS NULL and IS NOT NULL in comparisons that might contain null values.
78+
For a script to work as intended, regardless of the `ANSI_NULLS` database option or the setting of `SET ANSI_NULLS`, use `IS NULL` and `IS NOT NULL` in comparisons that might contain null values.
7679

77-
ANSI_NULLS should be set to ON for executing distributed queries.
80+
`ANSI_NULLS` should be set to ON for executing distributed queries.
7881

79-
ANSI_NULLS must also be ON when you are creating or changing indexes on computed columns or indexed views. If SET ANSI_NULLS is OFF, any CREATE, UPDATE, INSERT, and DELETE statements on tables with indexes on computed columns or indexed views will fail. [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] returns an error that lists all SET options that violate the required values. Also, when you execute a SELECT statement, if SET ANSI_NULLS is OFF, [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] ignores the index values on computed columns or views and resolve the select operation as if there were no such indexes on the tables or views.
82+
`ANSI_NULLS` must also be ON when you are creating or changing indexes on computed columns or indexed views. If SET ANSI_NULLS is OFF, any `CREATE`, `UPDATE`, `INSERT`, and `DELETE` statements on tables with indexes on computed columns or indexed views fail. [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] returns an error that lists all SET options that violate the required values. Also, when you execute a `SELECT` statement, if `SET ANSI_NULLS` is OFF, [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] ignores the index values on computed columns or views and resolve the select operation as if there were no such indexes on the tables or views.
8083

8184
> [!NOTE]
82-
> ANSI_NULLS is one of seven SET options that must be set to required values when dealing with indexes on computed columns or indexed views. The options `ANSI_PADDING`, `ANSI_WARNINGS`, `ARITHABORT`, `QUOTED_IDENTIFIER`, and `CONCAT_NULL_YIELDS_NULL` must also be set to ON, and `NUMERIC_ROUNDABORT` must be set to OFF.
85+
> `ANSI_NULLS` is one of seven SET options that must be set to required values when dealing with indexes on computed columns or indexed views. The options `ANSI_PADDING`, `ANSI_WARNINGS`, `ARITHABORT`, `QUOTED_IDENTIFIER`, and `CONCAT_NULL_YIELDS_NULL` must also be set to ON, and `NUMERIC_ROUNDABORT` must be set to OFF.
8386
84-
The [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] Native Client ODBC driver and [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] Native Client OLE DB Provider for [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] automatically set ANSI_NULLS to ON when connecting. This setting can be configured in ODBC data sources, in ODBC connection attributes, or in OLE DB connection properties that are set in the application before connecting to an instance of [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)]. The default for SET ANSI_NULLS is OFF.
87+
The [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] Native Client ODBC driver and [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] Native Client OLE DB Provider for [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] automatically set `ANSI_NULLS` to ON when connecting. This setting can be configured in ODBC data sources, in ODBC connection attributes, or in OLE DB connection properties that are set in the application before connecting to an instance of [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)]. The default for `SET ANSI_NULLS` is OFF.
8588

86-
When ANSI_DEFAULTS is ON, ANSI_NULLS is enabled.
89+
When `ANSI_DEFAULTS` is ON, `ANSI_NULLS` is enabled.
8790

88-
The setting of ANSI_NULLS is defined at execute or run time and not at parse time.
91+
The setting of `ANSI_NULLS` is defined at execute or run time and not at parse time.
8992

9093
To view the current setting for this setting, run the following query:
9194

@@ -99,7 +102,28 @@ SELECT @ANSI_NULLS AS ANSI_NULLS;
99102
Requires membership in the **public** role.
100103

101104
## Examples
102-
The following example uses the Equals (`=`) and Not Equal To (`<>`) comparison operators to make comparisons with `NULL` and non-null values in a table. The example also shows that `IS NULL` is not affected by the `SET ANSI_NULLS` setting.
105+
106+
The following example uses the Equals (`=`) and Not Equal To (`<>`) comparison operators to make comparisons with `NULL` or `0` and the `null` value in a variable.
107+
108+
```sql
109+
SET ANSI_NULLS OFF
110+
DECLARE @var INT = NULL
111+
SELECT
112+
IIF(@var = NULL, 'True', 'False') as EqualNull,
113+
IIF(@var <> NULL, 'True', 'False') as DifferentNull,
114+
IIF(@var = 0, 'True', 'False') as EqualZero,
115+
IIF(@var <> 0, 'True', 'False') as DifferentZero
116+
```
117+
118+
The results are show in the following table.
119+
120+
| EqualNull | DifferentNull | EqualZero | DifferentZero |
121+
| --- | --- | --- | --- |
122+
| True | False | False | True |
123+
124+
With `SET ANSI_NULLS ON` all expressions would be evaluated as 'False' because `NULL` cannot be compared with `NULL` or `0` using these operators.
125+
126+
The following example uses the Equals (`=`) and Not Equal To (`<>`) comparison operators to make comparisons with `NULL` and non-null values in a table. The example also shows the `SET ANSI_NULLS` setting does not affect `IS NULL`.
103127

104128
```sql
105129
-- Create table t1 and insert values.

docs/t-sql/statements/set-ansi-padding-transact-sql.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ title: "SET ANSI_PADDING (Transact-SQL)"
33
description: SET ANSI_PADDING controls the way the column stores values shorter than the defined size of the column.
44
author: WilliamDAssafMSFT
55
ms.author: wiassaf
6-
ms.reviewer: randolphwest
7-
ms.date: 07/08/2024
6+
ms.reviewer: randolphwest, jovanpop
7+
ms.date: 04/28/2025
88
ms.service: sql
99
ms.subservice: t-sql
1010
ms.topic: reference
@@ -28,6 +28,8 @@ monikerRange: ">=aps-pdw-2016 || =azure-sqldw-latest || >=sql-server-2016 || >=s
2828
[!INCLUDE [sql-asdbmi-asa-pdw-fabricse-fabricdw](../../includes/applies-to-version/sql-asdbmi-asa-pdw-fabricse-fabricdw.md)]
2929

3030
Controls the way the column stores values shorter than the defined size of the column, and the way the column stores values that have trailing blanks in **char**, **varchar**, **binary**, and **varbinary** data.
31+
- `SET ANSI_PADDING ON` - preserves the trailing blanks in the string values when they are inserted into a column. This is ANSI-compliant behavior.
32+
- `SET ANSI_PADDING OFF` - trims the trailing blanks in the string values when they are inserted into a column. This is not recommended behavior.
3133

3234
> [!NOTE]
3335
> `SET ANSI_PADDING OFF`, and the `ANSI_PADDING OFF` database option, are deprecated. In [!INCLUDE [_ss2017](../../includes/sssql17-md.md)] and later versions, and [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)] and [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)], `ANSI_PADDING` is always set to `ON`. Deprecated features shouldn't be used in new applications. For more information, see [Deprecated Database Engine features in SQL Server 2017](../../database-engine/deprecated-database-engine-features-in-sql-server-2017.md#transact-sql-1).

0 commit comments

Comments
 (0)