{"id":6167,"date":"2025-11-18T08:00:10","date_gmt":"2025-11-18T16:00:10","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/azure-sql\/?p=6167"},"modified":"2025-11-11T14:00:38","modified_gmt":"2025-11-11T22:00:38","slug":"sql-server-2025-embraces-vectors-setting-the-foundation-for-empowering-your-data-with-ai","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/azure-sql\/sql-server-2025-embraces-vectors-setting-the-foundation-for-empowering-your-data-with-ai\/","title":{"rendered":"SQL Server 2025 Embraces Vectors: setting the foundation for empowering your data with AI"},"content":{"rendered":"<p>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.<\/p>\n<p>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\u2019s enterprise-grade compliance and security features.<\/p>\n<p>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\u2014all within a single SELECT statement. Here\u2019s a sample query that shows how powerful, and beautiful, the simplicity can be:<\/p>\n<pre><code class=\"sql\">declare @e vector(1536) = ai_generate_embeddings('a place where to get the best pizza' use model Text3Small);\r\nselect top(30)\r\n    b.id as business_id,\r\n    b.name as business_name,\r\n    r.id as review_id,\r\n    r.stars,\r\n    r.review,    \r\n    vector_distance('cosine', re.embedding, @e) as semantic_distance,\r\n    @p.STDistance(geo_location) as geo_distance\r\nfrom\r\n    dbo.reviews r\r\ninner join  \r\n    dbo.reviews_embeddings re on r.id = re.review_id\r\ninner join \r\n    dbo.business b on r.business_id = b.id\r\nwhere\r\n    b.city = 'Seattle'\r\nand\r\n    @p.STDistance(b.geo_location) &lt; 1000 -- 1 km\r\nand\r\n    r.stars &gt;= 4\r\nand\r\n    b.reviews &gt;= 30\r\nand\r\n    json_contains(b.custom_attributes, cast(1 as bit), '$.local_recommended') = 1\r\nand\r\n    regexp_like(category, '(?:new york|detroit) style')\r\nand\r\n    vector_distance('cosine', re.embedding, @e) &lt; 0.2\r\norder by\r\n    semantic_similarity desc\r\n<\/code><\/pre>\n<p>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.<\/p>\n<h2>Vector Index and Preview Features<\/h2>\n<p>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.<\/p>\n<p>For more advanced scenarios, SQL Server 2025 introduces a set of powerful features in preview, accessible via the <a href=\"https:\/\/learn.microsoft.com\/sql\/sql-server\/preview-features-faq\">PREVIEW_FEATURES configuration<\/a>. 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 <a href=\"https:\/\/github.com\/microsoft\/DiskANN\">DiskANN<\/a>-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:<\/p>\n<pre><code class=\"sql\">ALTER DATABASE SCOPED CONFIGURATION SET PREVIEW_FEATURES = ON;\r\n<\/code><\/pre>\n<h2>Integration with AI features<\/h2>\n<p>SQL Server 2025 doesn\u2019t 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 <a href=\"https:\/\/learn.microsoft.com\/sql\/t-sql\/functions\/ai-generate-embeddings-transact-sql\">AI_GENERATE_EMBEDDINGS<\/a>. This capability eliminates the need for using dedicated libraries to generate embeddings and enables seamless creation of vectors directly from query pipelines.<\/p>\n<p>For model inference scenarios, SQL Server supports <a href=\"https:\/\/learn.microsoft.com\/sql\/t-sql\/statements\/create-external-model-transact-sql\">CREATE EXTERNAL MODEL<\/a>. This allows you to define and invoke external AI model endpoints\u2014whether 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.<\/p>\n<h2>Keep your data and you AI fully on on-premises, if you need to<\/h2>\n<p>In scenarios requiring airtight security, neither your data nor the AI models need to reside in the cloud. Everything can remain fully on-premises.\nYou 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\u2019s 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.<\/p>\n<h2>No more integration tax<\/h2>\n<p>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.<\/p>\n<h2>Seamless developer experience<\/h2>\n<p>This level of simplification extends to query design. You can filter by equality, run geospatial lookups, query JSON fields using the <a href=\"https:\/\/learn.microsoft.com\/sql\/t-sql\/statements\/create-json-index-transact-sql\">new JSON index<\/a>, perform embedding generation, invoke inference models, and execute similarity searches. All in the same query context. SQL Server\u2019s 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 <a href=\"https:\/\/learn.microsoft.com\/sql\/sql-server\/ai\/vectors?view=sql-server-ver17#exact-search-and-vector-distance-exact-nearest-neighbors\">exact similarity<\/a> using VECTOR_DISTANCE:<\/p>\n<pre><code class=\"sql\">SELECT id, VECTOR_DISTANCE('cosine', re.embedding, @e) AS cosine_distance\r\nFROM dbo.reviews_embeddings;\r\n<\/code><\/pre>\n<p>And scale up to <a href=\"https:\/\/learn.microsoft.com\/sql\/sql-server\/ai\/vectors?view=sql-server-ver17#approximate-vector-index-and-vector-search-approximate-nearest-neighbors\">approximate search<\/a> with preview features:<\/p>\n<pre><code class=\"sql\">CREATE VECTOR INDEX ixv ON dbo.reviews_embeddings(embedding)\r\n  WITH (METRIC='cosine', TYPE='DiskANN');\r\n\r\nSELECT TOP(10) id, distance\r\nFROM VECTOR_SEARCH(\r\n  TABLE = dbo.reviews_embeddings,\r\n  COLUMN = embedding,\r\n  SIMILAR_TO = @e,\r\n  METRIC = 'cosine',\r\n  TOP_N = 10\r\n) AS s\r\nORDER BY distance;\r\n<\/code><\/pre>\n<h2>Start building smarter applications right now<\/h2>\n<p>With SQL Server 2025, you\u2019re not just adding vector support: you\u2019re 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&#8217;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,<\/p>\n<ul>\n<li><a href=\"https:\/\/learn.microsoft.com\/sql\/sql-server\/ai\/artificial-intelligence-intelligent-applications\">Intelligent applications and AI<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/sql\/sql-server\/ai\/vectors\">Vector search and vector indexes in the SQL Database Engine<\/a><\/li>\n<\/ul>\n<p>And find answers to common questions, that will surely emerge as you dive deeper into AI and SQL integration, here:<\/p>\n<ul>\n<li><a href=\"https:\/\/learn.microsoft.com\/sql\/sql-server\/ai\/artificial-intelligence-intelligent-applications-faq\">Intelligent applications and AI Frequently Asked Questions (FAQ)<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/sql\/sql-server\/ai\/vectors-faq\">Vector and embeddings: Frequently asked questions (FAQ)<\/a><\/li>\n<\/ul>\n<p>And to get you started quickly, make sure to check out all the samples we built using SQL, Vectors and AI, here:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/Azure-Samples\/azure-sql-db-vector-search\">https:\/\/github.com\/Azure-Samples\/azure-sql-db-vector-search<\/a><\/li>\n<li><a href=\"https:\/\/ai.awesome.azuresql.dev\">https:\/\/ai.awesome.azuresql.dev<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":24720,"featured_media":6179,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[672,615],"tags":[590,627,569,677],"class_list":["post-6167","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql-server-2025","category-vectors","tag-ai","tag-rag","tag-vector","tag-vector-index"],"acf":[],"blog_post_summary":"<p>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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/posts\/6167","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/users\/24720"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/comments?post=6167"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/posts\/6167\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/media\/6179"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/media?parent=6167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/categories?post=6167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/tags?post=6167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}