Return result set

statements
#tsql#statements

The vector used for search. It must be a variable or a column of

type.

The distance metric used to calculate the distance between the query vector and the vectors in

the specified column. An ANN (Approximate Nearest Neighbor) index is used only if a

matching ANN index, with the same metric and on the same column, is found. If there are no

compatible ANN indexes, a warning is raised and the kNN (k-nearest neighbor) algorithm is

used.

The maximum number of similar vectors that must be returned. It must be a positive.

This parameter is not supported with vector indexes created using the latest version.

The alias is used to reference the result set.

The result set returned by the

function includes:

All columns from the table specified in the

argument.

An additional column named

, which represents the distance between the vector

in the column specified by the

argument and the vector provided in the

argument.

The distance column is generated by the

function itself, while all other columns

come from the table referenced in the

argument.

If you use an alias for the table in the

argument, you must use that same alias to

reference its columns in the

statement. You can’t use the alias assigned to

Warning

This parameter is deprecated and maintained only for backward compatibility with earlier

version vector indexes. For latest version indexes, use

syntax instead. New implementations should use the latest syntax.

Ascending order only

Post-filtering only

VECTOR_SEARCH

TABLE

distance

COLUMN

SIMILAR_TO

VECTOR_SEARCH

TABLE

TABLE

SELECT

SELECT TOP (N) WITH APPROXIMATE