DP-800 AI capabilities explained
Implement AI capabilities in database solutions is 25–30% of DP-800. It covers three areas: external models and embeddings, intelligent search (full-text, vector and hybrid) and retrieval-augmented generation (RAG) driven from T-SQL. The questions are practical: which search to choose, which embedding maintenance method fits, and how a prompt is assembled from query results.
Design and implement models and embeddings
An embedding is a vector of numbers produced by a model so that texts with similar meaning end up close together. The database stores those vectors and compares them.
- Evaluate external models: consider whether the model is multimodal, which languages it handles, its size and cost, its vector dimensions and whether it supports structured output.
- Create and manage external models: register a model endpoint in the database so that T-SQL can call it. Authenticate with a managed identity where possible instead of storing a key.
- Which columns to embed: embed the text that carries meaning (a title plus a description), not identifiers or numbers. Concatenate fields deliberately.
- Chunking: long documents are split into pieces that fit the model’s input limit and that each hold a coherent idea. Chunks that are too large blur meaning; too small lose context. Overlap helps keep context across boundaries.
- Generate embeddings: a T-SQL function calls the registered model and returns a vector you store in a
vectorcolumn.
Keeping embeddings current
| Method | Trade-off |
|---|---|
| Table trigger | Immediate, but adds model latency to transactions and risks failed writes |
| Change Tracking plus Azure Functions SQL trigger binding | Asynchronous, only changed rows |
| Azure Logic Apps | Low-code, good for integration scenarios |
| Change data capture | Reads changes from the log, with before and after values |
| Microsoft Foundry | Managed pipeline for embedding and indexing |
The usual exam answer is asynchronous: never make a user transaction wait for an external model.
Design and implement intelligent search
Choosing a search type
| Need | Use |
|---|---|
| Exact words, names, codes, phrases | Full-text search |
| Meaning, paraphrases, other wording | Vector (semantic) search |
| Both keyword precision and semantic recall | Hybrid search |
Vector data and functions
Store embeddings in the vector type with the dimensions your model produces. VECTOR_DISTANCE computes a distance between two vectors using a metric such as cosine, Euclidean or dot product, and VECTOR_NORMALIZE and VECTORPROPERTY help prepare and inspect vectors. VECTOR_SEARCH runs a nearest-neighbour search against a vector index.
KNN versus ANN. Exact k-nearest-neighbour search compares the query with every vector: perfect recall, cost grows with table size. Approximate nearest-neighbour search uses an index to find close vectors fast, at a small recall cost. Pick ANN for large tables and tight latency; pick exact search for small tables or when perfect results are required. Choose the distance metric that matches how the model was trained, and keep it consistent between index and query.
Hybrid search and RRF
Hybrid search runs a keyword search and a vector search, then merges the two result lists. Reciprocal rank fusion (RRF) scores each item by summing 1 / (k + rank) across lists, where k is a smoothing constant. Because it uses ranks, not raw scores, it does not matter that full-text and vector scores are on different scales. Evaluate search quality by measuring relevance on test queries as well as latency and index size.
Design and implement RAG
RAG answers a question using your data instead of the model’s memory. The steps:
- Embed the user’s question and retrieve the top matching rows or chunks.
- Convert the structured results to JSON (for example with
FOR JSON) so the model can read them. - Build a prompt containing instructions, the question and the retrieved context.
- Send it to the language model with the
sp_invoke_external_rest_endpointstored procedure, authenticating through a credential or managed identity. - Parse the JSON response, for example with
JSON_VALUE, and return the answer.
Use RAG when answers must reflect current private data, cite sources or avoid retraining. Do not use it when a simple SQL query already answers the question.
Sample questions
Question 1. Users search a catalogue for 'cheap laptop for students' and expect results even when product descriptions never use those exact words, but exact part numbers must still match when typed. Which approach fits best?
- A. Full-text search only
- B. Hybrid search combining full-text and vector search
- C. Vector search only
- D. A LIKE ‘%laptop%’ filter
Show answer
Answer: B
Hybrid search combines vector search, which finds results by meaning, with full-text search, which matches exact tokens such as part numbers. Full-text alone misses paraphrases. Vector alone can miss exact codes because embeddings do not preserve them reliably. A LIKE filter is neither semantic nor efficient.
Want more questions like this? Full DP-800 practice tests →
Question 2. Full-text search returns rank scores from 0 to 1000 and vector search returns cosine distances between 0 and 2. You must merge the two result lists without tuning a weighting between the incompatible scales. What should you use?
- A. Add the two raw scores
- B. Sort by the vector distance only
- C. Average the two raw scores
- D. Reciprocal rank fusion
Show answer
Answer: D
Reciprocal rank fusion uses each item’s rank in each list, so the different score scales do not matter. Adding raw scores mixes incompatible scales and lets one list dominate. Sorting by only the vector score ignores the keyword results. Averaging the two scores has the same scale problem as adding them.
Want more questions like this? Full DP-800 practice tests →
Question 3. In a RAG stored procedure you retrieved five matching product rows. The language model expects text input. How should you pass the rows into the prompt?
- A. Convert the rows to JSON and include it in the prompt
- B. Include the stored vector columns in the prompt
- C. Include only the row IDs
- D. Send the whole table
Show answer
Answer: A
Converting the rows to JSON with FOR JSON gives the model structured, readable context that is easy to place in the prompt. Passing the raw vector columns gives the model numbers it cannot interpret. Sending only row IDs gives it nothing to reason over. Sending the whole table exceeds input limits and defeats retrieval.
Want more questions like this? Full DP-800 practice tests →