The conversation I keep having
Over the last few months I've had some version of this conversation with almost every AI lead I've worked with: "We're building RAG over our product and customer data. Which vector database should we use?" Then I ask where that data lives today, and the answer is nearly always the same: SQL Server, Azure SQL, or more and more often a SQL database in Fabric.
So the plan becomes: export the rows, chunk them, embed them, load them into a second system, build a job to keep it fresh, re-implement the permissions, and hope nobody asks why the assistant quoted a price that changed yesterday. That's a lot of moving parts to stand up next to a database that, it turns out, can already do most of this itself.
I didn't fully appreciate that either. Until last week.
What surprised me while studying
Last week I passed DP-800, Developing AI-Enabled Database Solutions, Microsoft's exam for people who build on SQL Server, Azure SQL and SQL database in Fabric. According to its public skills outline, roughly a quarter of it (25 to 30%) is about implementing AI capabilities in the database itself: external models and embeddings, full-text, vector and hybrid search, and retrieval-augmented generation (RAG) driven from T-SQL.
I went in expecting the AI part to be about Copilot writing queries for me. There's some of that: GitHub Copilot, Copilot in Fabric, MCP servers pointed at a database. But what actually surprised me was how good SQL has become at the thing every RAG system lives or dies on: retrieval.
Not "it can store a vector if you insist". Properly good: a native vector type, an approximate index built on DiskANN (a graph-based algorithm from Microsoft Research designed for billion-scale nearest-neighbor search), hybrid search, and the plumbing to generate embeddings and call a model without leaving T-SQL.
What "AI in SQL" actually means now
If you keep one table from this post, make it this one. These are engine features, not add-ons bolted on the side.
| Capability | What it gives you |
|---|---|
| Vector data type and distance functions | Embeddings stored as a real column type, with cosine, Euclidean or dot-product distance computed in the engine. |
| Vector indexes and approximate search | Fast nearest-neighbor search over millions of vectors through a DiskANN graph index, instead of scanning every row. |
| Full-text search | Ranked keyword search the SQL engine has had for decades, now the keyword half of hybrid search. |
| External models, chunking and embedding functions | Register an embedding endpoint (Azure OpenAI, OpenAI, Ollama, or a local ONNX model on SQL Server) and chunk and embed text inside an ordinary INSERT or UPDATE. |
| Calling REST endpoints from T-SQL | Send retrieved rows to a language model as JSON from a stored procedure and read the answer back. |
Put together, that's a complete retrieval stack: chunk, embed, store, index, search, and hand the results to a model, all as T-SQL against the tables you already have.
Availability matters, so here's the short version. The vector type and functions are generally available in SQL Server 2025, Azure SQL Database, Azure SQL Managed Instance and SQL database in Fabric. Vector indexes and approximate search are generally available in Azure SQL Database, SQL database in Fabric and Managed Instance on the always-up-to-date policy, and still in preview in SQL Server 2025.
Why retrieval next to the data is the point
For the AI leaders reading this, here's the argument in one sentence: the hardest part of enterprise RAG isn't the vector math, it's keeping retrieval correct, fresh and permitted. Those are exactly the problems a database already solves.
The usual setup:
source of truth
chunk + embed
second copy
rebuilt by hand
What it can look like instead:
rows + embeddings, one security model
- No sync pipeline to babysit. The embedding sits on the row, or in a child table next to it. The skills outline even lists the ways to keep it fresh: triggers, Change Tracking, change data capture, change event streaming, and Azure Functions with SQL trigger bindings. That's a DBA's toolbox, not a new platform.
- Filters are just SQL. "Similar products, but in stock, in this region, under this price, for this customer" is a vector search plus a WHERE clause and a join against data you already trust. In a separate store, every one of those attributes has to be copied over and kept in sync.
- One security model. Embeddings live under the same permissions, auditing, encryption and backups as the data they came from. Calls to model endpoints can authenticate with a managed identity instead of keys in code.
- Transactions. When a product description changes, its embedding can change in the same unit of work. There's no window where the assistant answers from yesterday's text.
- Skills you already have. Execution plans, Query Store, indexes, CI/CD with SQL Database Projects. The people who already run this database can run its retrieval too.
Exact or approximate: the part DBAs will love
This is the bit that made the DBA in me smile, because it's a classic index trade-off with a new name.
Exact search (exact nearest neighbor, or kNN) compares the query against every candidate vector and sorts by distance. It's precise, and it's a scan. Microsoft's guidance is that exact search is fine when the candidate set is under roughly 50,000 vectors. The table can be far bigger, as long as your WHERE clause narrows the candidates down to that.
Approximate search (approximate nearest neighbor, or ANN) uses a vector index. Under the hood it's a DiskANN graph that lets the engine walk quickly toward the closest matches using SSDs and modest memory. You trade a little accuracy for a lot of speed.
The word to learn here is recall: the share of the true nearest neighbors that the approximate search actually returns. With recall close to 1, approximate results are practically the same as exact ones for RAG, because embeddings are approximations of meaning to begin with.
Hybrid search is where SQL shines
Pure vector search has a blind spot everyone hits eventually: exact identifiers. Ask for "SKU-4821-A" and the semantically closest product isn't what the user wants. They want that product. Keyword search nails it, and vectors fumble it.
The reverse is just as true. A keyword search for "water-resistant jacket" won't rank a "waterproof coat" well, while vectors handle it easily.
Hybrid search runs both and fuses the results. The standard way to fuse them is reciprocal rank fusion (RRF). Instead of comparing a keyword score with a vector distance, which live on different scales, RRF scores each document by its rank in each list, so items near the top of both lists win.
Here's why this surprised me most. SQL has had full-text search for decades. The keyword half of hybrid search isn't a new feature you have to take on trust, it's a mature one, now sitting next to a vector index on the same table. Fusing the two is a ranking query, which is exactly what T-SQL is good at. The skills outline lists choosing between full-text, vector and hybrid search, implementing RRF, and measuring the performance of each. That tells you how central it has become.
Where I'd still not use SQL
I'd be doing you a disservice if this read like "delete your vector database". Some honest limits:
- Large, unstructured, multi-source document collections. In my Site Investigation Report series, the municipal ordinance corpus lives in Azure AI Search: thousands of PDF pages, run through Document Intelligence, scoped by jurisdiction. That's still the right tool when the content is documents from many places rather than rows you already own.
- Preview status on the boxed product. Vector indexes are generally available in the Azure SQL family and Fabric, but still in preview in SQL Server 2025. If you're on-premises, plan for that.
- Model calls on the hot path. Generating embeddings or calling a language model inside a busy transaction ties database latency to an external endpoint. Embed on write, asynchronously where you can, and keep the request path to search.
- Re-embedding is real compute. Switching embedding models across millions of rows is a migration, not a configuration change. Budget it like one.
What this means for DBAs and AI leaders
For DBAs
AI has walked into your database, whether or not anyone told you. Embedding freshness, chunking strategy, vector index recall and model endpoint security are now database design decisions, and they belong with the people who already own the schema. If you want a structured way in, the DP-800 study guide is a good map, even if you never sit the exam.
For AI leaders
Before the next RAG project picks a vector store, ask three questions:
- Where does the data the model needs live today?
- Does that engine already do vector and hybrid search?
- What would it cost to keep a second copy correct, fresh and permitted?
If the answers are "SQL", "yes" and "more than we thought", start there. You might still end up with a dedicated search service, but it'll be a decision rather than a default.
Studying for DP-800 changed how I'll scope my next RAG engagement: retrieval starts where the data already is. I hope it does the same for someone else.
As usual, send me a note if you need to know more about this. Thank you!