VECTOR_DISTANCE
vector math
What changes
- Input
- vector values
- Output or change
- distance, norm, normalized vector or property
- Return type
- The function returns a scalar float value that represents the distance between the two vectors using the specified distance metric. An error is returned if distance_metric isn't a valid metric and if
Syntax at a glance
VECTOR_DISTANCE ( distance_metric , vector1 , vector2 )
Work example
Rank vectors by a selected distance metric for a SQL Server 2025 similarity query.
Use vectors from one model with equal dimensions and choose the metric expected by that model.
Check your work Different model spaces or vector dimensions make distance rankings meaningless.
Open Microsoft Learn for full syntax, permissions, and details for your version.