Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
SQL Server 2025 (17.x) Preview
Azure SQL Database
Azure SQL Managed Instance
SQL database in Microsoft Fabric Preview
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
VECTORPROPERTY is available in Azure SQL Managed Instance with the SQL Server 2025 or Always-up-to-date update policy.
Syntax
Transact-SQL syntax conventions
VECTORPROPERTY(vector , property)
Arguments
vector
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.
property
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).
Return value
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).
Examples
Retrieve dimension count
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');
Return count of 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