SQL Server 2025 marks a major milestone in database innovation by introducing native support for VECTOR data types and vector functions. These are now fully available in the freshly released SQL Server 2025 RTM.
This means you can store and process high-dimensional embeddings directly within your database. It eliminates the need to move data across separate systems. With this integration, your data remains secure, synchronized, and governed by SQL Server’s enterprise-grade compliance and security features.
The RTM release includes the VECTOR data type and built-in functions like VECTOR_DISTANCE. This supports cosine, Euclidean, and dot-product metrics for exact similarity comparisons. These functions are deeply integrated into the SQL Server engine. This allows you to write expressive queries that combine vector logic with traditional relational, JSON, and geospatial operations—all within a single SELECT statement. Here’s a sample query that shows how powerful, and beautiful, the simplicity can be:
declare @e vector(1536) = ai_generate_embeddings('a place where to get the best pizza' use model Text3Small);
select top(30)
b.id as business_id,
b.name as business_name,
r.id as review_id,
r.stars,
r.review,
vector_distance('cosine', re.embedding, @e) as semantic_distance,
@p.STDistance(geo_location) as geo_distance
from
dbo.reviews r
inner join
dbo.reviews_embeddings re on r.id = re.review_id
inner join
dbo.business b on r.business_id = b.id
where
b.city = 'Seattle'
and
@p.STDistance(b.geo_location) < 1000 -- 1 km
and
r.stars >= 4
and
b.reviews >= 30
and
json_contains(b.custom_attributes, cast(1 as bit), '$.local_recommended') = 1
and
regexp_like(category, '(?:new york|detroit) style')
and
vector_distance('cosine', re.embedding, @e) < 0.2
order by
semantic_similarity desc
With one simple query, you can instantly discover the best pizza spots in Seattle: recommended by locals, serving New York or Detroit style pizza, within 1 km of your location, rated 4 stars or higher, and backed by 30+ reviews. The query runs in milliseconds, yet you can build it in just minutes, not hours or days of complex integrations and costly architectures. A truly multi-model, scalable, and efficient solution.
Vector Index and Preview Features
SQL Server 2025 brings vector capabilities to production with the fully Generally Available VECTOR data type and VECTOR functions, such as VECTOR_DISTANCE, ready for use in enterprise-grade scenarios.
For more advanced scenarios, SQL Server 2025 introduces a set of powerful features in preview, accessible via the PREVIEW_FEATURES configuration. By enabling this option, you unlock approximate nearest neighbor search through the VECTOR_SEARCH function. It is optimized for retrieval augmented generation solutions, recommendation systems, semantic search and all the AI-related scenarios. You can create DiskANN-powered vector indexes using CREATE VECTOR INDEX. This allows fast and scalable similarity searches across billions of vectors. Additionally, support for half-precision (16-bit) vectors allows for efficient storage and querying of embeddings with up to approximately 4,000 dimensions. These preview features are designed to coexist with GA capabilities. So, you can experiment and scale without compromising stability. Activating them is straightforward:
ALTER DATABASE SCOPED CONFIGURATION SET PREVIEW_FEATURES = ON;
Integration with AI features
SQL Server 2025 doesn’t stop at vectors. It also brings other AI primitives into the core engine, creating an integrated AI ecosystem. You can generate embeddings from within the database using the new function AI_GENERATE_EMBEDDINGS. This capability eliminates the need for using dedicated libraries to generate embeddings and enables seamless creation of vectors directly from query pipelines.
For model inference scenarios, SQL Server supports CREATE EXTERNAL MODEL. This allows you to define and invoke external AI model endpoints—whether hosted in Azure, on-premises, or via third-party services. This tightly integrated path from data to inference streamlines AI workflows and keeps everything within your unified SQL environment.
Keep your data and you AI fully on on-premises, if you need to
In scenarios requiring airtight security, neither your data nor the AI models need to reside in the cloud. Everything can remain fully on-premises. You can run a variety of runtimes, such as Ollama, vLLM, NVIDIA NIM, or interact with any endpoint compatible with the OpenAI API, all entirely offline and local to your SQL Server. There’s no need to be tied to a specific model or vendor, and you can ensure your data remains fully on premises. Plus, you can load ONNX embedding models directly for even better performance.
No more integration tax
What makes this integration truly transformative is the elimination of the integration tax. Traditionally, building vector or AI solutions meant deploying separate vector stores, embedding pipelines, and inference infrastructure. All of these needed synchronization, security, and maintenance. With SQL Server 2025, all of that complexity vanishes. You gain the ability to manage structured data, unstructured content, vectors, embeddings, and AI model interaction. All within a single, unified, secure platform.
Seamless developer experience
This level of simplification extends to query design. You can filter by equality, run geospatial lookups, query JSON fields using the new JSON index, perform embedding generation, invoke inference models, and execute similarity searches. All in the same query context. SQL Server’s sophisticated query optimizer ensures each component is executed efficiently. It leverages the right indexes and runtime features, without requiring any manual plumbing. The developer experience is both seamless and powerful. You can start with exact similarity using VECTOR_DISTANCE:
SELECT id, VECTOR_DISTANCE('cosine', re.embedding, @e) AS cosine_distance
FROM dbo.reviews_embeddings;
And scale up to approximate search with preview features:
CREATE VECTOR INDEX ixv ON dbo.reviews_embeddings(embedding)
WITH (METRIC='cosine', TYPE='DiskANN');
SELECT TOP(10) id, distance
FROM VECTOR_SEARCH(
TABLE = dbo.reviews_embeddings,
COLUMN = embedding,
SIMILAR_TO = @e,
METRIC = 'cosine',
TOP_N = 10
) AS s
ORDER BY distance;
Start building smarter applications right now
With SQL Server 2025, you’re not just adding vector support: you’re transforming your data architecture. Your database becomes a single system that handles data storage, vector computation, embedding generation, model inference, and similarity search, all while maintaining enterprise security, compliance, and performance. Whether you’re building semantic search, intelligent chatbots, recommendation systems, or modern AI-driven application experiences, you can now do it all within the database you already trust. Read all about Vectors and AI in SQL Server 2025 here,
And find answers to common questions, that will surely emerge as you dive deeper into AI and SQL integration, here:
- Intelligent applications and AI Frequently Asked Questions (FAQ)
- Vector and embeddings: Frequently asked questions (FAQ)
And to get you started quickly, make sure to check out all the samples we built using SQL, Vectors and AI, here:
0 comments
Be the first to start the discussion.