Upraviť

Vector functions

Applies to: SQL Server 2025 (17.x) Azure SQL Database Azure SQL Managed Instance SQL database in Microsoft Fabric

The following scalar functions perform operations on vectors in binary format, allowing applications to store and manipulate vectors in the SQL Database Engine.

All vector functions support the vector data type.

Function Description
VECTOR_DISTANCE Calculates the distance between two vectors using a specified distance metric.
VECTOR_SEARCH Return the closest vectors to a given query vector and distance metric using an approximate vector search algorithm.
VECTOR_NORM Takes a vector as an input and returns the norm of the vector (which is a measure of its length or magnitude) in a given norm type.
VECTOR_NORMALIZE Takes a vector as an input and returns the normalized vector, which is a vector scaled to have a length of 1 in a given norm type. Adjusts a vector so that its length is normalized following the rules of specified norm type.
VECTORPROPERTY Returns specific properties of a given vector.

Platform availability

  • VECTOR_SEARCH is generally available (GA) in Azure SQL Database, SQL database in Microsoft Fabric, and Azure SQL Managed Instance with the Always-up-to-date update policy. It's in preview in SQL Server 2025 (17.x) and in Azure SQL Managed Instance with the SQL Server 2025 update policy.
  • The vector data type and vector functions are generally available in SQL Server 2025, Azure SQL Database, Azure SQL Managed Instance, and SQL database in Fabric.
  • Vector indexes are generally available in Azure SQL Database, SQL database in Fabric, and Azure SQL Managed Instance in the Always up to date update policy.
  • Vector indexes are preview features in SQL Server 2025 and Azure SQL Managed Instance in the SQL Server 2025 update policy.