You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/relational-databases/collations/collation-and-unicode-support.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ A collation specifies the bit patterns that represent each character in a data s
52
52
53
53
[!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).
54
54
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.
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.
20
24
21
25
## ALTER TABLE
22
-
26
+
23
27
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:
24
28
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.
26
30
27
-
-Without using an ALTER TABLE statement, the statements CREATE INDEX and DROP INDEX and ALTER INDEXare *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.
28
32
29
33
The following types of alterations are supported:
30
34
31
-
-Changing the bucket count
35
+
- Changing the bucket count
32
36
33
-
-Adding and removing an index
37
+
- Adding and removing an index
34
38
35
-
-Changing, adding and removing a column
39
+
- Changing, adding and removing a column
36
40
37
-
-Adding and removing a constraint
41
+
- Adding and removing a constraint
38
42
39
43
For more information on ALTER TABLE functionality and the complete syntax, see [ALTER TABLE (Transact-SQL)](../../t-sql/statements/alter-table-transact-sql.md)
40
44
41
-
## Schema-bound Dependency
45
+
## Schema-bound Dependency
46
+
42
47
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.
43
48
44
49
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
+
46
51
## Logging of ALTER TABLE on memory-optimized tables
52
+
47
53
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.
48
54
49
55
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
54
60
55
61
- Almost anything that affects an [off-row column](../../relational-databases/in-memory-oltp/supported-data-types-for-in-memory-oltp.md).
56
62
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
60
69
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.
62
71
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.
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
78
82
ALTERTABLESales.SalesOrderDetail_inmem
79
83
ADD Comment NVARCHAR(100) NOT NULL DEFAULT N'' WITH VALUES;
80
84
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
+
85
89
```sql
86
-
CREATETABLEdbo.UserSession (
87
-
SessionId intnot null,
88
-
UserId intnot null,
89
-
CreatedDate datetime2 not null,
90
-
ShoppingCartId int,
91
-
index ix_UserId nonclustered hash (UserId) with (bucket_count=400000)
92
-
)
90
+
CREATETABLEdbo.UserSession (
91
+
SessionId intnot null,
92
+
UserId intnot null,
93
+
CreatedDate datetime2 not null,
94
+
ShoppingCartId int,
95
+
index ix_UserId nonclustered hash (UserId) with (bucket_count=400000)
96
+
)
93
97
WITH (MEMORY_OPTIMIZED=ON, DURABILITY=SCHEMA_ONLY) ;
Copy file name to clipboardExpand all lines: docs/t-sql/functions/nchar-transact-sql.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,9 +36,9 @@ NCHAR ( integer_expression )
36
36
37
37
## Arguments
38
38
*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).
40
40
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.
42
42
43
43
## Return Types
44
44
**nchar(1)** when the default database collation does not support supplementary characters.
@@ -47,7 +47,7 @@ NCHAR ( integer_expression )
47
47
48
48
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.
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, `ø`.
67
67
68
-
```
68
+
```sql
69
69
DECLARE @nstring nchar(8);
70
70
SET @nstring = N'København';
71
71
SELECT UNICODE(SUBSTRING(@nstring, 2, 1)),
@@ -84,7 +84,7 @@ GO
84
84
### B. Using SUBSTRING, UNICODE, CONVERT, and NCHAR
85
85
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`.
86
86
87
-
```
87
+
```sql
88
88
-- The @position variable holds the position of the character currently
89
89
-- being processed. The @nstring variable is the Unicode character
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.
47
47
48
48
## Examples
49
49
50
50
### A. Using UNICODE and the NCHAR function
51
51
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, `Å`.
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`.
68
68
69
-
```
69
+
```sql
70
70
-- The @position variable holds the position of the character currently
71
71
-- being processed. The @nstring variable is the Unicode character
0 commit comments