Tomaz Kastrun continues a series on SQL Server 2025 with several posts on vector data. First up is the new vector data type:
The vector data type is designed to store vector data optimized for operations such as similarity search and machine learning applications. Vectors are stored in an optimized binary format but are exposed as JSON arrays for convenience.
Implicit and explicit conversion from and to the vector type can be done using varchar, nvarchar, and json types.
Second is information on vector functions:
Yesterday we looked into Vector data type and how to create table, insert the vector and read it. With SQL Server 2025, vector data type comes equipped also with couple of functions:
And third is how to generate embeddings and store the results in SQL Server:
AI_GENERATE_EMBEDDINGSis a built-in function that creates embeddings (vector arrays) using a pre-created AI model definition stored in the database.Before running, we need to register the model; creating the master key, database scope credentials and Creating external model.