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
@@ -41,8 +41,11 @@ A constant, also known as a literal or a scalar value, is a symbol that represen
41
41
42
42
## Character string constants
43
43
Character string constants are enclosed in single quotation marks and include alphanumeric characters (a-z, A-Z, and 0-9) and special characters, such as exclamation point (!), at sign (@), and number sign (#). Character string constants are assigned the default collation of the current database, unless the COLLATE clause is used to specify a collation. Character strings typed by users are evaluated through the code page of the computer and are translated to the database default code page if it is required.
44
+
45
+
> [!NOTE]
46
+
> When a [UTF8-enabled collation](../../relational-databases/collations/collation-and-unicode-support.md#utf8) is specified using the COLLATE clause, the character string behaves like a [Unicode string](#unicode-strings).
44
47
45
-
If the QUOTED_IDENTIFIER option has been set OFF for a connection, character strings can also be enclosed in double quotation marks, but the Microsoft [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] Native Client Provider and ODBC driver automatically use SET QUOTED_IDENTIFIER ON. We recommend using single quotation marks.
48
+
If the QUOTED_IDENTIFIER option has been set OFF for a connection, character strings can also be enclosed in double quotation marks, but the Microsoft [OLE DB Driver for SQL Server](../../connect/oledb/oledb-driver-for-sql-server.md) and [ODBC Driver for SQL Server](../../connect/odbc/download-odbc-driver-for-sql-server.md) automatically use `SET QUOTED_IDENTIFIER ON`. We recommend using single quotation marks.
46
49
47
50
If a character string enclosed in single quotation marks contains an embedded quotation mark, represent the embedded single quotation mark with two single quotation marks. This is not required in strings embedded in double quotation marks.
48
51
@@ -58,18 +61,23 @@ The following are examples of character strings:
58
61
59
62
Empty strings are represented as two single quotation marks with nothing in between. In 6.x compatibility mode, an empty string is treated as a single space.
60
63
61
-
Character string constants support enhanced collations.
64
+
Character string constants support enhanced [collations](../../relational-databases/collations/collation-and-unicode-support.md).
62
65
63
66
> [!NOTE]
64
-
> Character constants greater than 8000 bytes are typed as **varchar(max)** data.
67
+
> Character constants greater than 8000 bytes are typed as **varchar(max)** data.
65
68
66
69
## Unicode strings
67
-
Unicode strings have a format similar to character strings but are preceded by an N identifier (N stands for National Language in the SQL-92 standard). The N prefix must be uppercase. For example, 'Michél' is a character constant while N'Michél' is a Unicode constant. Unicode constants are interpreted as Unicode data, and are not evaluated by using a code page. Unicode constants do have a collation. This collation primarily controls comparisons and case sensitivity. Unicode constants are assigned the default collation of the current database, unless the COLLATE clause is used to specify a collation. Unicode data is stored by using 2 bytes per character instead of 1 byte per character for character data. For more information, see [Collation and Unicode Support](../../relational-databases/collations/collation-and-unicode-support.md).
70
+
Unicode strings have a format similar to character strings but are preceded by an N identifier (N stands for National Language in the SQL-92 standard) or specified through the use of the COLLATE clause with an [UTF8-enabled collation](../../relational-databases/collations/collation-and-unicode-support.md#utf8).
71
+
72
+
> [!IMPORTANT]
73
+
> The N prefix must be uppercase.
74
+
75
+
For example, `'Michél'` is a character constant while `N'Michél'` is a Unicode constant. Unicode constants are interpreted as Unicode data, and are not evaluated by using a code page. Unicode constants do have a collation. This collation primarily controls comparisons and case sensitivity. Unicode constants are assigned the default collation of the current database, unless the COLLATE clause is used to specify a collation. Unicode data uses the variable-width encoding. For more information, see [Collation and Unicode Support](../../relational-databases/collations/collation-and-unicode-support.md#storage_differences).
68
76
69
77
Unicode string constants support enhanced collations.
70
78
71
79
> [!NOTE]
72
-
> Unicode constants greater than 8000 bytes are typed as **nvarchar(max)** data.
80
+
> Unicode constants greater than 8000 bytes are typed as **nvarchar(max)** data.
73
81
74
82
## Binary constants
75
83
Binary constants have the prefix `0x` and are a string of hexadecimal numbers. They are not enclosed in quotation marks.
@@ -194,11 +202,12 @@ Signed **money** expressions:
194
202
```
195
203
196
204
## Enhanced Collations
197
-
SQL Server supports character and Unicode string constants that support enhanced collations. For more information, see the [COLLATE (Transact-SQL)](https://msdn.microsoft.com/library/4ba6b7d8-114a-4f4e-bb38-fe5697add4e9) clause.
205
+
The [!INCLUDE[ssde_md](../../includes/ssde_md.md)] supports character and Unicode string constants that support enhanced collations. For more information, see the [COLLATE (Transact-SQL)](../../t-sql/statements/collations.md) clause.
0 commit comments