Skip to content

Commit 9242a89

Browse files
committed
Add DacPac/BACPAC limitation and update GENERATE_SERIES code samples
1 parent 5f19017 commit 9242a89

2 files changed

Lines changed: 21 additions & 22 deletions

File tree

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

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: VECTOR_SEARCH search for vectors similar to a given query vectors u
44
author: mikerayMSFT
55
ms.author: mikeray
66
ms.reviewer: pookam, damauri, randolphwest, wiassaf
7-
ms.date: 03/07/2026
7+
ms.date: 03/18/2026
88
ms.service: sql
99
ms.subservice: t-sql
1010
ms.topic: reference
@@ -270,24 +270,19 @@ CREATE TABLE dbo.Articles
270270
GO
271271

272272
-- Step 2: Insert sample data (100 rows required for latest version indexes)
273-
DECLARE @i INT = 1;
274-
WHILE @i <= 100
275-
BEGIN
276-
INSERT INTO Articles (id, title, content, embedding)
277-
VALUES (
278-
@i,
279-
'Article ' + CAST(@i AS NVARCHAR(10)),
280-
'Content for article ' + CAST(@i AS NVARCHAR(10)),
281-
JSON_ARRAY(
282-
CAST(@i * 0.01 AS FLOAT),
283-
CAST(@i * 0.02 AS FLOAT),
284-
CAST(@i * 0.03 AS FLOAT),
285-
CAST(@i * 0.04 AS FLOAT),
286-
CAST(@i * 0.05 AS FLOAT)
287-
)
288-
);
289-
SET @i = @i + 1;
290-
END
273+
INSERT INTO Articles (id, title, content, embedding)
274+
SELECT
275+
value AS id,
276+
'Article ' || [value],
277+
'Content for article ' || [value],
278+
CAST(JSON_ARRAY(
279+
CAST(value * 0.01 AS FLOAT),
280+
CAST(value * 0.02 AS FLOAT),
281+
CAST(value * 0.03 AS FLOAT),
282+
CAST(value * 0.04 AS FLOAT),
283+
CAST(value * 0.05 AS FLOAT)
284+
) AS VECTOR(5))
285+
FROM GENERATE_SERIES(1, 100);
291286
GO
292287

293288
-- Step 3: Create a vector index on the embedding column

docs/t-sql/statements/create-vector-index-transact-sql.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: CREATE VECTOR INDEX creates an index on vector data to allow approx
44
author: mikerayMSFT
55
ms.author: mikeray
66
ms.reviewer: pookam, damauri, randolphwest, wiassaf
7-
ms.date: 03/07/2026
7+
ms.date: 03/18/2026
88
ms.service: sql
99
ms.subservice: t-sql
1010
ms.topic: reference
@@ -258,6 +258,10 @@ The current preview has the following limitations:
258258

259259
- Tables with vector indexes can't be truncated using `TRUNCATE TABLE`. To remove all data, drop the vector index first, truncate the table, repopulate with at least 100 rows, then recreate the index. For more information, see [TRUNCATE TABLE restrictions](../functions/vector-search-transact-sql.md#truncate-table-restrictions).
260260

261+
- Vector indexes can't be deployed with DacPac or BACPAC. Vector indexes require at least 100 rows with non-NULL vectors at creation time. When you import a database using DacPac, BACPAC, or the Import/Export service, the import process creates schema objects (including vector indexes) before loading data, which causes the import to fail.
262+
263+
**Workaround**: Drop vector indexes before exporting the database, and recreate the indexes after import.
264+
261265
### Minimum data requirements
262266

263267
Vector indexes require a minimum number of rows with non-NULL vector values before the index can be created.
@@ -444,8 +448,8 @@ GO
444448
INSERT INTO Articles (id, title, content, embedding)
445449
SELECT
446450
value AS id,
447-
'Article ' + CAST(value AS NVARCHAR(10)),
448-
'Content for article ' + CAST(value AS NVARCHAR(10)),
451+
'Article ' || [value],
452+
'Content for article ' || [value],
449453
CAST(JSON_ARRAY(
450454
CAST(value * 0.01 AS FLOAT),
451455
CAST(value * 0.02 AS FLOAT),

0 commit comments

Comments
 (0)