| title | VECTORPROPERTY (Transact-SQL) | ||
|---|---|---|---|
| description | VECTORPROPERTY function returns specific properties of a given vector. | ||
| author | WilliamDAssafMSFT | ||
| ms.author | wiassaf | ||
| ms.reviewer | damauri, pookam, randolphwest | ||
| ms.date | 05/01/2025 | ||
| ms.update-cycle | 180-days | ||
| ms.service | sql | ||
| ms.subservice | t-sql | ||
| ms.topic | reference | ||
| ms.collection |
|
||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
||
| monikerRange | >=sql-server-ver17 || >=sql-server-linux-ver17 || =azuresqldb-current || =azuresqldb-mi-current || =fabric | ||
| ms.custom |
|
[!INCLUDE sqlserver2025-asdb-asmi-fabricsqldb]
The VECTORPROPERTY function returns specific properties of a given vector. The function requires two arguments: the vector itself and the property to be retrieved.
Note
- This function is in preview and is subject to change. Make sure to read preview usage terms in Service Level Agreements (SLA) for Online Services.
VECTORPROPPERTYis available in Azure SQL Managed Instance configured with the Always-up-to-date update policy.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
VECTORPROPERTY(vector, property)
A valid vector of the vector type. This can be an expression, such as a variable or a reference to a column.
The input vector might be specified as [tablename].[colname] or as a valid variable of the vector type.
An expression specifying the name of the database property to return. The property supports one of the following values:
| Property | Description | Value Returned |
|---|---|---|
Dimensions |
Return vector's dimensions count | Integer value with dimension count. |
BaseType |
Return vector's base type | sysname with the name of the data type. |
The default base type for vectors is currently set to float (32-bit).
The function returns the specific properties of a given vector based on the property selected. For example:
- If the property is
Dimensions, the function returns an integer value representing the dimension count of the vector. - If the property is
BaseType, the function returns the name of the data type (sysname).
In the following example, declare a vector with three dimensions and retrieve its dimensions count. The VECTORPROPERTY function returns the integer value 3 representing the dimension count.
DECLARE @v AS VECTOR(3) = '[1,2,3]';
SELECT VECTORPROPERTY(@v, 'Dimensions');The following example retrieves the dimensions count of a vector column embeddings from a table mytable.
CREATE TABLE mytable
(
id INT IDENTITY NOT NULL PRIMARY KEY,
embeddings VECTOR(3) NOT NULL
);
INSERT INTO mytable (embeddings)
VALUES ('[4, -2, -1]'),
('[1, 3, -5]'),
('[7, -8, -10]'),
('[4.0, 0.2, -1.1]'),
('[0, 0, 0]'),
('[10, 10, 10]'),
('[-0.1, -0.2, -0.3]');
SELECT VECTORPROPERTY(t.embeddings, 'dimensions')
FROM mytable AS t;Returns:
Dimensions
----------
3
3
3
3
3
3
3