|
1 | 1 | --- |
2 | | -title: "Supported Data Types for In-Memory OLTP" |
| 2 | +title: Supported Data Types for In-Memory OLTP |
3 | 3 | description: Learn about data types that are unsupported for the In-Memory OLTP features memory-optimized tables and natively compiled T-SQL modules. |
4 | 4 | author: MikeRayMSFT |
5 | 5 | ms.author: mikeray |
6 | | -ms.date: "06/19/2017" |
| 6 | +ms.reviewer: randolphwest |
| 7 | +ms.date: 10/27/2025 |
7 | 8 | ms.service: sql |
8 | 9 | ms.subservice: in-memory-oltp |
9 | 10 | ms.topic: conceptual |
10 | | -monikerRange: "=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current" |
| 11 | +monikerRange: "=azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current" |
11 | 12 | --- |
12 | | -# Supported Data Types for In-Memory OLTP |
| 13 | +# Supported data types for In-Memory OLTP |
| 14 | + |
13 | 15 | [!INCLUDE [SQL Server Azure SQL Database Azure SQL Managed Instance](../../includes/applies-to-version/sql-asdb-asdbmi.md)] |
14 | 16 |
|
15 | | - This article lists the data types that are unsupported for the In-Memory OLTP features of: |
16 | | - |
17 | | -- Memory-optimized tables |
18 | | - |
19 | | -- Natively compiled T-SQL modules |
20 | | - |
21 | | -## Unsupported Data Types |
22 | | - The following data types are not supported: |
23 | | - |
24 | | -:::row::: |
25 | | - :::column::: |
26 | | - [datetimeoffset (Transact-SQL)](../../t-sql/data-types/datetimeoffset-transact-sql.md) |
27 | | - |
28 | | - [hierarchyid (Transact-SQL)](../../t-sql/data-types/hierarchyid-data-type-method-reference.md) |
29 | | - |
30 | | - [sql_variant (Transact-SQL)](../../t-sql/data-types/sql-variant-transact-sql.md) |
31 | | - :::column-end::: |
32 | | - :::column::: |
33 | | - [geography (Transact-SQL)](../../t-sql/spatial-geography/spatial-types-geography.md) |
34 | | - |
35 | | - [rowversion (Transact-SQL)](../../t-sql/data-types/rowversion-transact-sql.md) |
36 | | - |
37 | | - User-Defined Types |
38 | | - :::column-end::: |
39 | | - :::column::: |
40 | | - [geometry (Transact-SQL)](../../t-sql/spatial-geometry/spatial-types-geometry-transact-sql.md) |
41 | | - |
42 | | - [xml (Transact-SQL)](../../t-sql/xml/xml-transact-sql.md) |
43 | | - :::column-end::: |
44 | | -:::row-end::: |
45 | | - |
46 | | -## Notable Supported Data Types |
47 | | - Most data types are supported by the features of In-Memory OLTP. The following few are worth noting explicitly: |
48 | | - |
49 | | -|String and Binary Types|For more information| |
50 | | -|-----------------------------|--------------------------| |
51 | | -|binary and varbinary*|[binary and varbinary (Transact-SQL)](../../t-sql/data-types/binary-and-varbinary-transact-sql.md)| |
52 | | -|char and varchar*|[char and varchar (Transact-SQL)](../../t-sql/data-types/char-and-varchar-transact-sql.md)| |
53 | | -|nchar and nvarchar*|[nchar and nvarchar (Transact-SQL)](../../t-sql/data-types/nchar-and-nvarchar-transact-sql.md)| |
54 | | - |
55 | | -For the preceding string and binary data types, starting with SQL Server 2016: |
56 | | - |
57 | | -- An individual memory-optimized table can also have several long columns such as `nvarchar(4000)`, even though their lengths would add to more than the physical row size of 8060 bytes. |
58 | | - |
59 | | -- A memory-optimized table can have max length string and binary columns of data types such as `varchar(max)`. |
| 17 | +This article lists the data types that are unsupported for the In-Memory OLTP features of: |
| 18 | + |
| 19 | +- Memory-optimized tables |
| 20 | +- Natively compiled Transact-SQL (T-SQL) modules |
| 21 | + |
| 22 | +## Unsupported data types |
| 23 | + |
| 24 | +The following data types aren't supported: |
| 25 | + |
| 26 | +- [datetimeoffset](../../t-sql/data-types/datetimeoffset-transact-sql.md) |
| 27 | +- [geography](../../t-sql/spatial-geography/spatial-types-geography.md) |
| 28 | +- [geometry](../../t-sql/spatial-geometry/spatial-types-geometry-transact-sql.md) |
| 29 | +- [hierarchyid](../../t-sql/data-types/hierarchyid-data-type-method-reference.md) |
| 30 | +- [json](../../t-sql/data-types/json-data-type.md) |
| 31 | +- [rowversion](../../t-sql/data-types/rowversion-transact-sql.md) |
| 32 | +- [sql_variant](../../t-sql/data-types/sql-variant-transact-sql.md) |
| 33 | +- [vector](../../t-sql/data-types/vector-data-type.md) |
| 34 | +- [xml](../../t-sql/xml/xml-transact-sql.md) |
| 35 | +- User-defined types |
| 36 | + |
| 37 | +## Notable supported data types |
60 | 38 |
|
| 39 | +In-Memory OLTP features support most data types. The following list is worth noting explicitly: |
| 40 | + |
| 41 | +| String and binary types | For more information | |
| 42 | +| --- | --- | |
| 43 | +| **binary** and **varbinary** | [binary and varbinary](../../t-sql/data-types/binary-and-varbinary-transact-sql.md) | |
| 44 | +| **char** and **varchar** | [char and varchar](../../t-sql/data-types/char-and-varchar-transact-sql.md) | |
| 45 | +| **nchar** and **nvarchar** | [nchar and nvarchar](../../t-sql/data-types/nchar-and-nvarchar-transact-sql.md) | |
| 46 | + |
| 47 | +For the preceding string and binary data types, starting with [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)]: |
| 48 | + |
| 49 | +- An individual memory-optimized table can also have several long columns such as **nvarchar(4000)**, even though their lengths would add to more than the physical row size of 8,060 bytes. |
| 50 | + |
| 51 | +- A memory-optimized table can have max length string and binary columns of data types such as **varchar(max)**. |
61 | 52 |
|
62 | 53 | ### Identify LOBs and other columns that are off-row |
63 | 54 |
|
64 | | -Starting with SQL Server 2016, memory-optimized tables [support off-row columns](../../relational-databases/in-memory-oltp/table-and-row-size-in-memory-optimized-tables.md), which allow a single table row to be larger than 8060 bytes. The following Transact-SQL SELECT statement reports all columns that are off-row, for memory-optimized tables. Note that: |
| 55 | +In [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)] and later versions, memory-optimized tables support [off-row columns](table-and-row-size-in-memory-optimized-tables.md), which allow a single table row to be larger than 8,060 bytes. The following Transact-SQL `SELECT` statement reports all columns that are off-row, for memory-optimized tables: |
65 | 56 |
|
66 | 57 | - All index key columns are stored in-row. |
67 | | - - Nonunique index keys can now include NULLable columns, on memory-optimized tables. |
68 | | - - Indexes can be declared as UNIQUE on a memory-optimized table. |
| 58 | + - Nonunique index keys can include nullable columns on memory-optimized tables. |
| 59 | + - Indexes can be declared as `UNIQUE` on a memory-optimized table. |
69 | 60 | - All LOB columns are stored off-row. |
70 | | -- A max_length of -1 indicates a large object (LOB) column. |
71 | | - |
| 61 | +- A `max_length` of `-1` indicates a large object (LOB) column. |
72 | 62 |
|
73 | 63 | ```sql |
74 | | -SELECT |
75 | | - OBJECT_NAME(m.object_id) as [table], |
76 | | - c.name as [column], |
77 | | - c.max_length |
78 | | - FROM |
79 | | - sys.memory_optimized_tables_internal_attributes AS m |
80 | | - JOIN sys.columns AS c |
81 | | - ON m.object_id = c.object_id |
82 | | - AND m.minor_id = c.column_id |
83 | | - WHERE |
84 | | - m.type = 5; |
| 64 | +SELECT OBJECT_NAME(m.object_id) AS [table], |
| 65 | + c.name AS [column], |
| 66 | + c.max_length |
| 67 | +FROM sys.memory_optimized_tables_internal_attributes AS m |
| 68 | + INNER JOIN sys.columns AS c |
| 69 | + ON m.object_id = c.object_id |
| 70 | + AND m.minor_id = c.column_id |
| 71 | +WHERE m.type = 5; |
85 | 72 | ``` |
86 | 73 |
|
| 74 | +### Other data types |
87 | 75 |
|
88 | | -### Other Data Types |
| 76 | +| Other types | For more information | |
| 77 | +| --- | --- | |
| 78 | +| **table** types | [Faster temp table and table variable by using memory optimization](faster-temp-table-and-table-variable-by-using-memory-optimization.md) | |
89 | 79 |
|
| 80 | +## Related content |
90 | 81 |
|
91 | | -|Other Types|For more information| |
92 | | -|-----------------|--------------------------| |
93 | | -|table types|[Memory-Optimized Table Variables](../../relational-databases/in-memory-oltp/faster-temp-table-and-table-variable-by-using-memory-optimization.md)| |
94 | | - |
95 | | -## See Also |
96 | | - [Transact-SQL Support for In-Memory OLTP](../../relational-databases/in-memory-oltp/transact-sql-support-for-in-memory-oltp.md) |
97 | | - [Implementing SQL_VARIANT in a Memory-Optimized Table](../../relational-databases/in-memory-oltp/implementing-sql-variant-in-a-memory-optimized-table.md) |
98 | | - [Table and Row size in Memory-Optimized Table](../../relational-databases/in-memory-oltp/table-and-row-size-in-memory-optimized-tables.md) |
99 | | - |
100 | | - |
| 82 | +- [Transact-SQL Support for In-Memory OLTP](transact-sql-support-for-in-memory-oltp.md) |
| 83 | +- [Implementing SQL_VARIANT in a Memory-Optimized Table](implementing-sql-variant-in-a-memory-optimized-table.md) |
| 84 | +- [Table and row size in memory-optimized tables](table-and-row-size-in-memory-optimized-tables.md) |
0 commit comments