Skip to content

Commit 57bfe0e

Browse files
committed
Merging changes synced from https://github.com/MicrosoftDocs/sql-docs-pr (branch live)
2 parents 6f10bcf + 3fb1a74 commit 57bfe0e

5 files changed

Lines changed: 155 additions & 147 deletions

File tree

docs/relational-databases/collations/collation-and-unicode-support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ A collation specifies the bit patterns that represent each character in a data s
5252

5353
[!INCLUDE[tsql](../../includes/tsql-md.md)] statement results can vary when the statement is run in the context of different databases that have different collation settings. If it is possible, use a standardized collation for your organization. This way, you do not have to explicitly specify the collation in every character or Unicode expression. If you must work with objects that have different collation and code page settings, code your queries to consider the rules of collation precedence. For more information, see [Collation Precedence (Transact-SQL)](../../t-sql/statements/collation-precedence-transact-sql.md).
5454

55-
The options associated with a collation are case sensitivity, accent sensitivity, Kana-sensitivity, width sensitivity, variation-selector-sensitivity. [!INCLUDE[sql-server-2019](../../includes/sssqlv15-md.md)] introduces an additional option for UTF-8 encoding. These options are specified by appending them to the collation name. For example, this collation `Japanese_Bushu_Kakusu_100_CS_AS_KS_WS_UTF8` is case-sensitive, accent-sensitive, Kana-sensitive, width-sensitive, and UTF-8 encoded. As another example, this collation `Japanese_Bushu_Kakusu_140_CI_AI_KS_WS_VSS` is case-insensitive, accent-insensitive, Kana-sensitive, width-sensitive, variation-selector-sensitive and uses non-Unicode encoding. The following table describes the behavior associated with these various options.
55+
The options associated with a collation are case sensitivity, accent sensitivity, Kana-sensitivity, width sensitivity, variation-selector-sensitivity. [!INCLUDE[sql-server-2019](../../includes/sssqlv15-md.md)] introduces an additional option for [UTF-8](http://www.wikipedia.org/wiki/UTF-8) encoding. These options are specified by appending them to the collation name. For example, this collation `Japanese_Bushu_Kakusu_100_CS_AS_KS_WS_UTF8` is case-sensitive, accent-sensitive, Kana-sensitive, width-sensitive, and UTF-8 encoded. As another example, this collation `Japanese_Bushu_Kakusu_140_CI_AI_KS_WS_VSS` is case-insensitive, accent-insensitive, Kana-sensitive, width-sensitive, variation-selector-sensitive and uses non-Unicode encoding. The following table describes the behavior associated with these various options.
5656

5757
|Option|Description|
5858
|------------|-----------------|
Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Altering Memory-Optimized Tables | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "06/19/2017"
4+
ms.date: "10/22/2018"
55
ms.prod: sql
66
ms.prod_service: "database-engine, sql-database"
77
ms.reviewer: ""
@@ -14,36 +14,42 @@ manager: craigg
1414
monikerRange: "=azuresqldb-current||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017||=azuresqldb-mi-current"
1515
---
1616
# Altering Memory-Optimized Tables
17+
1718
[!INCLUDE[appliesto-ss-asdb-xxxx-xxx-md](../../includes/appliesto-ss-asdb-xxxx-xxx-md.md)]
1819

19-
Schema and index changes on memory-optimized tables can be performed by using the ALTER TABLE statement. In SQL Server 2016 and Azure SQL Database ALTER TABLE operations on memory-optimized tables are OFFLINE, meaning that the table is not available for querying while the operation is in progress. The database application can continue to run, and any operation that is accessing the table is blocked until the alteration process is completed. It is possible to combine multiple ADD, DROP or ALTER operations in a single ALTER TABLE statement.
20+
Schema and index changes on memory-optimized tables can be performed by using the ALTER TABLE statement. In SQL Server 2016 and Azure SQL Database ALTER TABLE operations on memory-optimized tables are OFFLINE, meaning that the table is not available for querying while the operation is in progress. The database application can continue to run, and any operation that is accessing the table is blocked until the alteration process is completed. It is possible to combine multiple ADD, DROP or ALTER operations in a single ALTER TABLE statement.
21+
22+
> [!IMPORTANT]
23+
> Azure SQL Database Managed Instance does not support memory-optimized tables.
2024
2125
## ALTER TABLE
22-
26+
2327
The ALTER TABLE syntax is used for making changes to the table schema, as well as for adding, deleting, and rebuilding indexes. Indexes are considered part of the table definition:
2428

25-
- The syntax ALTER TABLE ... ADD/DROP/ALTER INDEX is supported only for memory-optimized tables.
29+
- The syntax ALTER TABLE ... ADD/DROP/ALTER INDEX is supported only for memory-optimized tables.
2630

27-
- Without using an ALTER TABLE statement, the statements CREATE INDEX and DROP INDEX and ALTER INDEX are *not* supported for indexes on memory-optimized tables.
31+
- Without using an ALTER TABLE statement, the statements [CREATE INDEX](../../t-sql/statements/create-index-transact-sql.md), [DROP INDEX](../../t-sql/statements/drop-index-transact-sql.md), [ALTER INDEX](../../t-sql/statements/alter-index-transact-sql.md), and [PAD_INDEX](../../t-sql/statements/alter-table-index-option-transact-sql.md) are not supported for indexes on memory-optimized tables.
2832

2933
The following types of alterations are supported:
3034

31-
- Changing the bucket count
35+
- Changing the bucket count
3236

33-
- Adding and removing an index
37+
- Adding and removing an index
3438

35-
- Changing, adding and removing a column
39+
- Changing, adding and removing a column
3640

37-
- Adding and removing a constraint
41+
- Adding and removing a constraint
3842

3943
For more information on ALTER TABLE functionality and the complete syntax, see [ALTER TABLE (Transact-SQL)](../../t-sql/statements/alter-table-transact-sql.md)
4044

41-
## Schema-bound Dependency
45+
## Schema-bound Dependency
46+
4247
Natively compiled stored procedures are required to be schema-bound, meaning they have a schema-bound dependency on the memory optimized tables they access, and the columns they reference. A schema-bound dependency is a relationship between two entities that prevents the referenced entity from being dropped or incompatibly modified as long as the referencing entity exists.
4348

4449
For example, if a schema-bound natively compiled stored procedure references a column *c1* from table *mytable*, column *c1* cannot be dropped. Similarly, if there is such a procedure with an INSERT statement without column list (e.g., `INSERT INTO dbo.mytable VALUES (...)`), then no column in the table can be dropped.
45-
50+
4651
## Logging of ALTER TABLE on memory-optimized tables
52+
4753
On a memory-optimized table, most ALTER TABLE scenarios now run in parallel and result in an optimization of writes to the transaction log. The optimization is achieved by only logging the metadata changes to the transaction log. However, the following ALTER TABLE operations run single-threaded and are not log-optimized.
4854

4955
The single-threaded operation in this case would log the entire content of the altered table to the transaction log. A list of single-threaded operations follows:
@@ -54,68 +60,66 @@ The single-threaded operation in this case would log the entire content of the a
5460

5561
- Almost anything that affects an [off-row column](../../relational-databases/in-memory-oltp/supported-data-types-for-in-memory-oltp.md).
5662

57-
- Cause an on-row column to move off-row.
58-
59-
- Cause an off-row column to move on-row.
63+
- Cause an on-row column to move off-row.
64+
- Cause an off-row column to move on-row.
65+
- Create a new off-row column.
66+
- *Exception:* Lengthening an already off-row column is logged in the optimized way.
67+
68+
## Examples
6069

61-
- Create a new off-row column.
70+
The following example alters the bucket count of an existing hash index. This rebuilds the hash index with the new bucket count while other properties of the hash index remain the same.
6271

63-
- *Exception:* Lengthening an already off-row column is logged in the optimized way.
64-
65-
## Examples
66-
The following example alters the bucket count of an existing hash index. This rebuilds the hash index with the new bucket count while other properties of the hash index remain the same.
67-
6872
```sql
69-
ALTER TABLE Sales.SalesOrderDetail_inmem
73+
ALTER TABLE Sales.SalesOrderDetail_inmem
7074
ALTER INDEX imPK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID
7175
REBUILD WITH (BUCKET_COUNT=67108864);
7276
GO
7377
```
74-
75-
The following example adds a column with a NOT NULL constraint and with a DEFAULT definition, and uses WITH VALUES to provide values for each existing row in the table. If WITH VALUES is not used, each row has the value NULL in the new column.
76-
77-
```sql
78+
79+
The following example adds a column with a NOT NULL constraint and with a DEFAULT definition, and uses WITH VALUES to provide values for each existing row in the table. If WITH VALUES is not used, each row has the value NULL in the new column.
80+
81+
```sql
7882
ALTER TABLE Sales.SalesOrderDetail_inmem
7983
ADD Comment NVARCHAR(100) NOT NULL DEFAULT N'' WITH VALUES;
8084
GO
81-
```
82-
83-
The following example adds a primary key constraint to an existing column.
84-
85+
```
86+
87+
The following example adds a primary key constraint to an existing column.
88+
8589
```sql
86-
CREATE TABLE dbo.UserSession (
87-
SessionId int not null,
88-
UserId int not null,
89-
CreatedDate datetime2 not null,
90-
ShoppingCartId int,
91-
index ix_UserId nonclustered hash (UserId) with (bucket_count=400000)
92-
)
90+
CREATE TABLE dbo.UserSession (
91+
SessionId int not null,
92+
UserId int not null,
93+
CreatedDate datetime2 not null,
94+
ShoppingCartId int,
95+
index ix_UserId nonclustered hash (UserId) with (bucket_count=400000)
96+
)
9397
WITH (MEMORY_OPTIMIZED=ON, DURABILITY=SCHEMA_ONLY) ;
9498
GO
9599

96100
ALTER TABLE dbo.UserSession
97101
ADD CONSTRAINT PK_UserSession PRIMARY KEY NONCLUSTERED (SessionId);
98102
GO
99-
```
100-
101-
The following example removes an index.
102-
103+
```
104+
105+
The following example removes an index.
106+
103107
```sql
104108
ALTER TABLE Sales.SalesOrderDetail_inmem
105109
DROP INDEX ix_ModifiedDate;
106110
GO
107111
```
108-
109-
The following example adds an index.
110-
112+
113+
The following example adds an index.
114+
111115
```sql
112116
ALTER TABLE Sales.SalesOrderDetail_inmem
113117
ADD INDEX ix_ModifiedDate (ModifiedDate);
114118
GO
115119
```
116-
117-
The following example adds multiple columns, with an index and constraints.
118-
120+
121+
The following example adds multiple columns, with an index and constraints.
122+
119123
```sql
120124
ALTER TABLE Sales.SalesOrderDetail_inmem
121125
ADD CustomerID int NOT NULL DEFAULT -1 WITH VALUES,
@@ -124,12 +128,8 @@ ALTER TABLE Sales.SalesOrderDetail_inmem
124128
GO
125129
```
126130

127-
128131
<a name="logging-of-alter-table-on-memory-optimized-tables-124"></a>
129132

130-
131133
## See Also
132134

133135
[Memory-Optimized Tables](../../relational-databases/in-memory-oltp/memory-optimized-tables.md)
134-
135-

docs/t-sql/functions/nchar-transact-sql.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ NCHAR ( integer_expression )
3636

3737
## Arguments
3838
*integer_expression*
39-
When the collation of the database does not contain the supplementary character (SC) flag, this is a positive whole number from 0 through 65535 (0 through 0xFFFF). If a value outside this range is specified, NULL is returned. For more information about supplementary characters, see [Collation and Unicode Support](../../relational-databases/collations/collation-and-unicode-support.md).
39+
When the collation of the database does not contain the [Supplementary Character (SC)](../../relational-databases/collations/collation-and-unicode-support.md#Supplementary_Characters) flag, this is a positive integer from 0 through 65535 (0 through 0xFFFF). If a value outside this range is specified, NULL is returned. For more information about supplementary characters, see [Collation and Unicode Support](../../relational-databases/collations/collation-and-unicode-support.md).
4040

41-
When the collation of the database supports the supplementary character (SC) flag, this is a positive whole number from 0 through 1114111 (0 through 0x10FFFF). If a value outside this range is specified, NULL is returned.
41+
When the collation of the database supports the SC flag, this is a positive integer from 0 through 1114111 (0 through 0x10FFFF). If a value outside this range is specified, NULL is returned.
4242

4343
## Return Types
4444
**nchar(1)** when the default database collation does not support supplementary characters.
@@ -47,7 +47,7 @@ NCHAR ( integer_expression )
4747

4848
If the parameter *integer_expression* lies in the range 0 - 0xFFFF, only one character is returned. For higher values, NCHAR returns the corresponding surrogate pair. Do not construct a surrogate pair by using `NCHAR(<High surrogate>) + NCHAR(\<Low Surrogate>)`. Instead, use a database collation that supports supplementary characters and then specify the Unicode codepoint for the surrogate pair. The following example demonstrates both the old style method of constructing a surrogate pair and the preferred method of specifying the Unicode codepoint.
4949

50-
```
50+
```sql
5151
CREATE DATABASE test COLLATE Finnish_Swedish_100_CS_AS_SC;
5252
DECLARE @d nvarchar(10) = N'𣅿';
5353
-- Old style method.
@@ -65,7 +65,7 @@ SELECT NCHAR(UNICODE(@d));
6565
### A. Using NCHAR and UNICODE
6666
The following example uses the `UNICODE` and `NCHAR` functions to print the `UNICODE` value and the `NCHAR` (Unicode character) of the second character of the `København` character string, and to print the actual second character, `ø`.
6767

68-
```
68+
```sql
6969
DECLARE @nstring nchar(8);
7070
SET @nstring = N'København';
7171
SELECT UNICODE(SUBSTRING(@nstring, 2, 1)),
@@ -84,7 +84,7 @@ GO
8484
### B. Using SUBSTRING, UNICODE, CONVERT, and NCHAR
8585
The following example uses the `SUBSTRING`, `UNICODE`, `CONVERT`, and `NCHAR` functions to print the character number, the Unicode character, and the UNICODE value of each character in the string `København`.
8686

87-
```
87+
```sql
8888
-- The @position variable holds the position of the character currently
8989
-- being processed. The @nstring variable is the Unicode character
9090
-- string to process.

docs/t-sql/functions/unicode-transact-sql.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ UNICODE ( 'ncharacter_expression' )
4343
**int**
4444

4545
## Remarks
46-
In versions of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] earlier than [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] and in [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)], the UNICODE function returns a UCS-2 codepoint in the range 0 through 0xFFFF. In [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] and later editions, when using SC collations, UNICODE returns a UTF-16 codepoint in the range 0 through 0x10FFFF.
46+
In versions of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] earlier than [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] and in [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)], the UNICODE function returns a UCS-2 codepoint in the range 0 through 0xFFFF. Starting with [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)], when using [Supplementary Character (SC)](../../relational-databases/collations/collation-and-unicode-support.md#Supplementary_Characters) enabled collations, UNICODE returns a UTF-16 codepoint in the range 0 through 0x10FFFF.
4747

4848
## Examples
4949

5050
### A. Using UNICODE and the NCHAR function
5151
The following example uses the `UNICODE` and `NCHAR` functions to print the UNICODE value of the first character of the `Åkergatan` 24-character string, and to print the actual first character, `Å`.
5252

53-
```
53+
```sql
5454
DECLARE @nstring nchar(12);
5555
SET @nstring = N'Åkergatan 24';
5656
SELECT UNICODE(@nstring), NCHAR(UNICODE(@nstring));
@@ -66,7 +66,7 @@ SELECT UNICODE(@nstring), NCHAR(UNICODE(@nstring));
6666
### B. Using SUBSTRING, UNICODE, and CONVERT
6767
The following example uses the `SUBSTRING`, `UNICODE`, and `CONVERT` functions to print the character number, the Unicode character, and the UNICODE value of each of the characters in the string `Åkergatan 24`.
6868

69-
```
69+
```sql
7070
-- The @position variable holds the position of the character currently
7171
-- being processed. The @nstring variable is the Unicode character
7272
-- string to process.

0 commit comments

Comments
 (0)