Skip to content

Commit 88cdf59

Browse files
Merge pull request #36141 from rwestMSFT/rw-1229-sqlmi
Add SQL MI support to vector articles
2 parents e9abfb6 + b1a0d1b commit 88cdf59

4 files changed

Lines changed: 51 additions & 39 deletions

File tree

docs/t-sql/functions/ai-generate-chunks-transact-sql.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: The AI_GENERATE_CHUNKS table-valued function creates text chunks.
44
author: jettermctedder
55
ms.author: bspendolini
66
ms.reviewer: randolphwest
7-
ms.date: 11/18/2025
7+
ms.date: 01/06/2026
88
ms.service: sql
99
ms.subservice: t-sql
1010
ms.topic: reference
@@ -18,15 +18,16 @@ helpviewer_keywords:
1818
- "ai_generate_chunks"
1919
dev_langs:
2020
- TSQL
21-
monikerRange: "=azuresqldb-current || >=sql-server-ver17 || >=sql-server-linux-ver17 || =fabric-sqldb"
21+
monikerRange: "=sql-server-ver17 || =sql-server-linux-ver17 || =azuresqldb-current || =azuresqldb-mi-current || =fabric-sqldb"
2222
---
2323
# AI_GENERATE_CHUNKS (Transact-SQL)
2424

25-
[!INCLUDE [sqlserver2025-asdb-fabricsqldb](../../includes/applies-to-version/sqlserver2025-asdb-fabricsqldb.md)]
25+
[!INCLUDE [sqlserver2025-asdb-asmi-fabricsqldb](../../includes/applies-to-version/sqlserver2025-asdb-asmi-fabricsqldb.md)]
2626

27-
`AI_GENERATE_CHUNKS` is a table-valued function that creates "chunks", or fragments of text based on a type, size, and source expression.
27+
`AI_GENERATE_CHUNKS` is a table-valued function that creates *chunks*, or fragments of text based on a type, size, and source expression.
2828

29-
#### Compatibility level 170
29+
> [!NOTE]
30+
> `AI_GENERATE_CHUNKS` is available in [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)] with the **SQL Server 2025** or **Always-up-to-date** [update policy](/azure/azure-sql/managed-instance/update-policy).
3031
3132
`AI_GENERATE_CHUNKS` requires the compatibility level to be at least 170. When the level is less than 170, the [!INCLUDE [ssde-md](../../includes/ssde-md.md)] is unable to find the `AI_GENERATE_CHUNKS` function.
3233

@@ -37,39 +38,39 @@ To change the compatibility level of a database, refer to [View or change the co
3738
:::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)
3839

3940
```syntaxsql
40-
AI_GENERATE_CHUNKS (source = text_expression
41-
, chunk_type = FIXED
42-
[ , chunk_size = numeric_expression ]
43-
[ , overlap = numeric_expression ]
44-
[ , enable_chunk_set_id = numeric_expression ]
41+
AI_GENERATE_CHUNKS (SOURCE = text_expression
42+
, CHUNK_TYPE = FIXED
43+
[ , CHUNK_SIZE = numeric_expression ]
44+
[ , OVERLAP = numeric_expression ]
45+
[ , ENABLE_CHUNK_SET_ID = numeric_expression ]
4546
)
4647
```
4748

4849
## Arguments
4950

50-
#### *source*
51+
#### SOURCE = *text_expression*
5152

5253
An [expression](../language-elements/expressions-transact-sql.md) of any character type (for example, **nvarchar**, **varchar**, **nchar**, or **char**).
5354

54-
#### *chunk_type*
55+
#### CHUNK_TYPE = FIXED
5556

56-
A string literal naming the type or method to chunk the text/document and can't be `NULL` or a value from a column.
57+
A string literal naming the type or method to chunk the text/document. This value can't be `NULL` or a value from a column.
5758

58-
Accepted values for this release:
59+
Accepted values are:
5960

6061
- `FIXED`
6162

62-
#### *chunk_size*
63+
#### CHUNK_SIZE = *numeric_expression*
6364

64-
When `chunk_type` is `FIXED`, this parameter sets the character count size of each chunk specified as a variable, a literal, or a scalar expression of type **tinyint**, **smallint**, **int**, or **bigint**. *chunk_size* can't be `NULL`, negative, or zero (`0`). This parameter is also **required** when using a `chunk_type` of `FIXED`.
65+
When `CHUNK_TYPE` is `FIXED`, this parameter sets the character count size of each chunk specified as a variable, a literal, or a scalar expression of type **tinyint**, **smallint**, **int**, or **bigint**. `CHUNK_SIZE` can't be `NULL`, negative, or zero (`0`). This parameter is required when using a `CHUNK_TYPE` of `FIXED`.
6566

66-
#### *overlap*
67+
#### OVERLAP = *numeric_expression*
6768

68-
The *overlap* parameter determines the percentage of the preceding text that should be included in the current chunk. This percentage is applied to the `chunk_size` parameter to calculate the size in characters. The *overlap* value can be specified as a variable, a literal, or a scalar expression of type tinyint, smallint, int, or bigint. It must be a whole number between zero (`0`) and 50, inclusive, and can't be `NULL` or negative. The default value is zero (`0`).
69+
The `OVERLAP` parameter determines the percentage of the preceding text that should be included in the current chunk. This percentage is applied to the `CHUNK_SIZE` parameter to calculate the size in characters. The `OVERLAP` value can be specified as a variable, a literal, or a scalar expression of type tinyint, smallint, int, or bigint. It must be a whole number between zero (`0`) and 50, inclusive, and can't be `NULL` or negative. The default value is zero (`0`).
6970

70-
#### *enable_chunk_set_id*
71+
#### ENABLE_CHUNK_SET_ID = *numeric_expression*
7172

72-
An **int** or **bit** expression that serves as a flag to enable or disable the `chunk_set_id` output column; a column that returns a number to help group returned chunks belonging to the same source. A value of `1` enables the column. If *enable_chunk_set_id* is omitted, `NULL`, or has a value of `0`, the `chunk_set_id` column is disabled and not returned.
73+
An **int** or **bit** expression that serves as a flag to enable or disable the `chunk_set_id` output column; a column that returns a number to help group returned chunks belonging to the same source. A value of `1` enables the column. If `ENABLE_CHUNK_SET_ID` is omitted, `NULL`, or has a value of `0`, the `chunk_set_id` column is disabled and not returned.
7374

7475
## Return types
7576

@@ -81,7 +82,7 @@ An **int** or **bit** expression that serves as a flag to enable or disable the
8182
| `chunk_order` | **bigint** | A sequence of ordered numbers that relates to the order each chunk was processed starting with `1` and increasing by `1`. |
8283
| `chunk_offset` | **bigint** | Position of the chunk of the source data/document in relation to the start of the chunking process. |
8384
| `chunk_length` | **int** | Character length of the returned text chunk. |
84-
| `chunk_set_id` | **bigint** | An *optional column* that contains an ID that groups all the chunks of a source expression, document, or row. If multiple documents or rows are chunked in a single transaction, they're each given a different `chunk_set_id`. Visibility is controlled by the `enable_chunk_set_id` parameter. |
85+
| `chunk_set_id` | **bigint** | An *optional column* that contains an ID that groups all the chunks of a source expression, document, or row. If multiple documents or rows are chunked in a single transaction, they're each given a different `chunk_set_id`. Visibility is controlled by the `ENABLE_CHUNK_SET_ID` parameter. |
8586

8687
### Return example
8788

@@ -91,7 +92,7 @@ Here's an example of the return results of `AI_GENERATE_CHUNKS` with the followi
9192

9293
- Chunk size of 50 characters.
9394

94-
- The 'chunk_set_id' is enabled.
95+
- The `chunk_set_id` is enabled.
9596

9697
- Chunk text: `All day long we seemed to dawdle through a country which was full of beauty of every kind. Sometimes we saw little towns or castles on the top of steep hills such as we see in old missals; sometimes we ran by rivers and streams which seemed from the wide stony margin on each side of them to be subject to great floods.`
9798

@@ -147,7 +148,7 @@ CROSS APPLY
147148

148149
### A. Chunk a text column with FIXED type and size of 100 characters
149150

150-
The following example uses `AI_GENERATE_CHUNKS` to chunk a text column. It uses a `chunk_type` of `FIXED` and a `chunk_size` of 100 characters.
151+
The following example uses `AI_GENERATE_CHUNKS` to chunk a text column. It uses a `CHUNK_TYPE` of `FIXED` and a `CHUNK_SIZE` of 100 characters.
151152

152153
```sql
153154
SELECT c.chunk
@@ -158,7 +159,7 @@ CROSS APPLY
158159

159160
### B. Chunk a text column with overlap
160161

161-
The following example uses `AI_GENERATE_CHUNKS` to chunk a text column using overlap. It uses the chunk_type of FIXED, a chunk_size of 100 characters, and an overlap of 10 percent.
162+
The following example uses `AI_GENERATE_CHUNKS` to chunk a text column using overlap. It uses the `CHUNK_TYPE` of `FIXED`, a `CHUNK_SIZE` of 100 characters, and an overlap of 10 percent.
162163

163164
```sql
164165
SELECT c.chunk

docs/t-sql/functions/ai-generate-embeddings-transact-sql.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: The AI_GENERATE_EMBEDDINGS function creates vector arrays for data.
44
author: jettermctedder
55
ms.author: bspendolini
66
ms.reviewer: randolphwest
7-
ms.date: 01/02/2026
7+
ms.date: 01/06/2026
88
ms.service: sql
99
ms.subservice: t-sql
1010
ms.topic: reference
@@ -18,14 +18,17 @@ helpviewer_keywords:
1818
- "ai_generate_embeddings"
1919
dev_langs:
2020
- TSQL
21-
monikerRange: "=azuresqldb-current || >=sql-server-ver17 || >=sql-server-linux-ver17 || =fabric-sqldb"
21+
monikerRange: "=sql-server-ver17 || =sql-server-linux-ver17 || =azuresqldb-current || =azuresqldb-mi-current || =fabric-sqldb"
2222
---
2323
# AI_GENERATE_EMBEDDINGS (Transact-SQL)
2424

25-
[!INCLUDE [sqlserver2025-asdb-fabricsqldb](../../includes/applies-to-version/sqlserver2025-asdb-fabricsqldb.md)]
25+
[!INCLUDE [sqlserver2025-asdb-asmi-fabricsqldb](../../includes/applies-to-version/sqlserver2025-asdb-asmi-fabricsqldb.md)]
2626

2727
`AI_GENERATE_EMBEDDINGS` is a built-in function that creates embeddings (vector arrays) using a precreated AI model definition stored in the database.
2828

29+
> [!NOTE]
30+
> `AI_GENERATE_EMBEDDINGS` is available in [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)] with the **Always-up-to-date** [update policy](/azure/azure-sql/managed-instance/update-policy).
31+
2932
## Syntax
3033

3134
:::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)

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Vector functions perform operations on vector type allowing applica
44
author: WilliamDAssafMSFT
55
ms.author: wiassaf
66
ms.reviewer: damauri, pookam, randolphwest
7-
ms.date: 11/18/2025
7+
ms.date: 01/06/2026
88
ms.service: sql
99
ms.subservice: system-objects
1010
ms.topic: reference
@@ -27,10 +27,9 @@ monikerRange: "=sql-server-ver17 || =sql-server-linux-ver17 || =azuresqldb-curre
2727
The following scalar functions perform operations on [vectors](../../sql-server/ai/vectors.md) in binary format, allowing applications to store and manipulate vectors in the SQL Database Engine.
2828

2929
> [!NOTE]
30-
>
31-
> Vector features are available in Azure SQL Managed Instance with the **SQL Server 2025** or **Always-up-to-date** [update policy](/azure/azure-sql/managed-instance/update-policy).
30+
> Vector features are available in [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)] with the **SQL Server 2025** or **Always-up-to-date** [update policy](/azure/azure-sql/managed-instance/update-policy).
3231
33-
All Vector functions support the [Vector data type](../data-types/vector-data-type.md).
32+
All vector functions support the [**vector** data type](../data-types/vector-data-type.md).
3433

3534
| Function | Description |
3635
| --- | --- |

docs/t-sql/statements/create-external-model-transact-sql.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: CREATE EXTERNAL MODEL (Transact-SQL) for creating an external model
44
author: jettermctedder
55
ms.author: bspendolini
66
ms.reviewer: randolphwest
7-
ms.date: 12/04/2025
7+
ms.date: 01/06/2026
88
ms.service: sql
99
ms.subservice: t-sql
1010
ms.topic: reference
@@ -22,15 +22,18 @@ helpviewer_keywords:
2222
dev_langs:
2323
- TSQL
2424
ai-usage: ai-assisted
25-
monikerRange: "=azuresqldb-current || >=sql-server-ver17 || >=sql-server-linux-ver17 || =fabric-sqldb"
25+
monikerRange: "=sql-server-ver17 || =sql-server-linux-ver17 || =azuresqldb-current || =azuresqldb-mi-current || =fabric-sqldb"
2626
---
2727

2828
# CREATE EXTERNAL MODEL (Transact-SQL)
2929

30-
[!INCLUDE [sqlserver2025-asdb-fabricsqldb](../../includes/applies-to-version/sqlserver2025-asdb-fabricsqldb.md)]
30+
[!INCLUDE [sqlserver2025-asdb-asmi-fabricsqldb](../../includes/applies-to-version/sqlserver2025-asdb-asmi-fabricsqldb.md)]
3131

3232
Creates an external model object that contains the location, authentication method, and purpose of an AI model inference endpoint.
3333

34+
> [!NOTE]
35+
> `CREATE EXTERNAL MODEL` is available in [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)] with the **Always-up-to-date** [update policy](/azure/azure-sql/managed-instance/update-policy).
36+
3437
## Syntax
3538

3639
:::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)
@@ -39,7 +42,7 @@ Creates an external model object that contains the location, authentication meth
3942
CREATE EXTERNAL MODEL external_model_object_name
4043
[ AUTHORIZATION owner_name ]
4144
WITH
42-
( LOCATION = '<prefix>://<path>[:<port>]'
45+
( LOCATION = '<prefix>://<path>[:<port>]'
4346
, API_FORMAT = '<OpenAI, Azure OpenAI, etc>'
4447
, MODEL_TYPE = EMBEDDINGS
4548
, MODEL = 'text-embedding-model-name'
@@ -51,11 +54,11 @@ WITH
5154

5255
## Arguments
5356

54-
### external_model_object_name
57+
### *external_model_object_name*
5558

5659
Specifies the user-defined name for the external model. The name must be unique within the database.
5760

58-
### owner_name
61+
### *owner_name*
5962

6063
Specifies the name of the user or role that owns the external model. If you don't specify this argument, the current user becomes the owner. Depending on permissions and roles, you might need to grant explicit permission to users to use specific external models.
6164

@@ -402,7 +405,7 @@ Use the following PowerShell script to provide the MSSQLLaunchpad user access to
402405
```powershell
403406
$AIExtPath = "C:\onnx_runtime";
404407
$Acl = Get-Acl -Path $AIExtPath
405-
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("MSSQLLaunchpad", "FullControl", "ContainerInherit,ObjectInherit", "None","Allow")
408+
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("MSSQLLaunchpad", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
406409
$Acl.AddAccessRule($AccessRule)
407410
Set-Acl -Path $AIExtPath -AclObject $Acl
408411
```
@@ -456,7 +459,13 @@ ADD EVENT ai_generate_embeddings_airuntime_trace
456459
ACTION (sqlserver.sql_text, sqlserver.session_id)
457460
)
458461
ADD TARGET package0.ring_buffer
459-
WITH (MAX_MEMORY = 4096 KB, EVENT_RETENTION_MODE = ALLOW_SINGLE_EVENT_LOSS, MAX_DISPATCH_LATENCY = 30 SECONDS, TRACK_CAUSALITY = ON, STARTUP_STATE = OFF);
462+
WITH (
463+
MAX_MEMORY = 4096 KB,
464+
EVENT_RETENTION_MODE = ALLOW_SINGLE_EVENT_LOSS,
465+
MAX_DISPATCH_LATENCY = 30 SECONDS,
466+
TRACK_CAUSALITY = ON,
467+
STARTUP_STATE = OFF
468+
);
460469
GO
461470
462471
ALTER EVENT SESSION newevt ON SERVER STATE = START;

0 commit comments

Comments
 (0)