🔒 Guided

Pre-launch preview. Authorised access only.

Incorrect code

Guided by A Guide to Cloud
Explore AB-900 AI-901
Guided DP-800 Domain 3
Domain 3 — Module 1 of 7 14%
22 of 28 overall

DP-800 Study Guide

Domain 1: Design and Develop Database Solutions

  • Table Design: Columns, Types, and Indexes Free
  • Constraints: Protecting Your Data Free
  • Specialised Tables and Graph Queries Free
  • JSON in SQL: Store, Query, and Index
  • Programmability: Views, Functions, Procedures, and Triggers
  • Advanced T-SQL: CTEs, Windows, and Correlated Queries
  • Pattern Power: Regular Expressions in T-SQL
  • Fuzzy String Matching: Finding Similar Text
  • AI-Assisted SQL with GitHub Copilot Free
  • MCP: Connecting AI to Your Database

Domain 2: Secure, Optimize, and Deploy Database Solutions

  • Encryption: Always Encrypted and Column-Level
  • Dynamic Data Masking and Row-Level Security
  • Permissions, Auditing, and Passwordless Access
  • Transaction Isolation and Concurrency
  • Query Performance: Plans, DMVs, and Query Store
  • SQL Database Projects: Build and Validate
  • CI/CD Pipelines for SQL Databases
  • Data API Builder: REST and GraphQL from SQL
  • Securing AI and API Endpoints
  • Change Detection: CES, CDC, and Change Tracking
  • Azure Integration and Monitoring

Domain 3: Implement AI Capabilities in Database Solutions

  • External AI Models: Choose, Create, Manage
  • Embeddings: Design, Chunk, and Generate
  • Choose Your Search Strategy
  • Vector Data: Types, Indexes, and Storage
  • Vector Search: Distance, ANN, and ENN
  • Hybrid Search and Reciprocal Rank Fusion
  • RAG with SQL: Prompt, Process, Respond

DP-800 Study Guide

Domain 1: Design and Develop Database Solutions

  • Table Design: Columns, Types, and Indexes Free
  • Constraints: Protecting Your Data Free
  • Specialised Tables and Graph Queries Free
  • JSON in SQL: Store, Query, and Index
  • Programmability: Views, Functions, Procedures, and Triggers
  • Advanced T-SQL: CTEs, Windows, and Correlated Queries
  • Pattern Power: Regular Expressions in T-SQL
  • Fuzzy String Matching: Finding Similar Text
  • AI-Assisted SQL with GitHub Copilot Free
  • MCP: Connecting AI to Your Database

Domain 2: Secure, Optimize, and Deploy Database Solutions

  • Encryption: Always Encrypted and Column-Level
  • Dynamic Data Masking and Row-Level Security
  • Permissions, Auditing, and Passwordless Access
  • Transaction Isolation and Concurrency
  • Query Performance: Plans, DMVs, and Query Store
  • SQL Database Projects: Build and Validate
  • CI/CD Pipelines for SQL Databases
  • Data API Builder: REST and GraphQL from SQL
  • Securing AI and API Endpoints
  • Change Detection: CES, CDC, and Change Tracking
  • Azure Integration and Monitoring

Domain 3: Implement AI Capabilities in Database Solutions

  • External AI Models: Choose, Create, Manage
  • Embeddings: Design, Chunk, and Generate
  • Choose Your Search Strategy
  • Vector Data: Types, Indexes, and Storage
  • Vector Search: Distance, ANN, and ENN
  • Hybrid Search and Reciprocal Rank Fusion
  • RAG with SQL: Prompt, Process, Respond
Domain 3: Implement AI Capabilities in Database Solutions Premium ⏱ ~12 min read

External AI Models: Choose, Create, Manage

Evaluate and integrate external AI models into your SQL database — understand model types, sizes, languages, structured output, and how to create and manage model definitions.

Bringing AI into your database

☕ Simple explanation

Think of hiring a specialist consultant.

Your database is great at storing and querying data. But it cannot understand natural language, recognise images, or generate text — that is not its job. External AI models are specialists you hire: one understands English and Japanese, another can read images, and a third generates structured JSON from questions. You register them in your database so your T-SQL code can call them directly.

The key decision: which specialist do you hire for each task? A cheap, fast one for simple jobs? A powerful, expensive one for complex analysis? This module teaches you how to choose.

SQL Server 2025 and Azure SQL support external model definitions — database objects that register AI model endpoints (Azure OpenAI, Microsoft Foundry, or custom endpoints) so they can be invoked from T-SQL. The DP-800 exam tests: evaluating models across dimensions (modality, language, size, structured output), creating model definitions with CREATE EXTERNAL MODEL, and managing model lifecycle.

Evaluating external models

When choosing a model for your SQL-based AI solution, evaluate across four dimensions:

Four evaluation dimensions for external models
DimensionWhat to EvaluateTrade-off
ModalityText-only, multimodal (text+image+audio), or embedding modelsMultimodal models are more versatile but larger and more expensive
LanguageMonolingual (English) or multilingual (100+ languages)Multilingual models handle global data but may be less precise in each language
SizeSmall (fast, cheap), medium (balanced), large (most capable)Larger models produce better results but cost more per token and have higher latency
Structured outputCan the model return JSON, XML, or structured formats reliably?Essential for database integration — unstructured text is hard to INSERT into tables

Model size guide

Size CategoryExamplesTokens/secBest For
SmallGPT-4o-mini, Phi-3Very fastClassification, simple extraction, embeddings
MediumGPT-4oFastGeneral Q&A, summarisation, code generation
LargeGPT-4, o1-seriesSlowerComplex reasoning, multi-step analysis
Embeddingtext-embedding-3-small/largeVery fastVector search, semantic similarity
💡 Exam tip: Structured output is critical for SQL integration

When calling an AI model from T-SQL (via sp_invoke_external_rest_endpoint), you need the response in a parseable format — typically JSON. Models that reliably produce structured JSON output are essential. If the model returns free-form text, you cannot reliably extract values into table columns.

Look for models that support JSON mode or structured output schemas in their API. The exam may present a scenario where the model returns inconsistent formats — the fix is configuring structured output in the API call.

Creating external models in SQL

External models are database objects that register an AI endpoint:

-- Create an external model definition
CREATE EXTERNAL MODEL EmbeddingModel
WITH (
    MODEL_TYPE = 'EMBEDDINGS',
    ENDPOINT = 'https://vaultbank-ai.openai.azure.com/',
    DEPLOYMENT_NAME = 'text-embedding-3-small',
    API_KEY_SECRET_NAME = 'AzureOpenAI_Key',
    API_FORMAT = 'OPENAI'
);

-- Create a model for text generation
CREATE EXTERNAL MODEL ChatModel
WITH (
    MODEL_TYPE = 'COMPLETIONS',
    ENDPOINT = 'https://vaultbank-ai.openai.azure.com/',
    DEPLOYMENT_NAME = 'gpt-4o',
    API_KEY_SECRET_NAME = 'AzureOpenAI_Key',
    API_FORMAT = 'OPENAI'
);

Managing models

-- View all registered models
SELECT * FROM sys.external_models;

-- Alter model (e.g., change deployment)
ALTER EXTERNAL MODEL ChatModel
SET DEPLOYMENT_NAME = 'gpt-4o-2024-11-20';

-- Drop model
DROP EXTERNAL MODEL EmbeddingModel;

Security for model endpoints

Model endpoints require authentication. Options:

  • API keys stored as database-scoped credentials
  • Managed Identity (preferred for Azure-hosted databases)
  • Key Vault references for centralised secret management
-- Using managed identity (no secrets needed)
CREATE EXTERNAL MODEL SecureModel
WITH (
    MODEL_TYPE = 'COMPLETIONS',
    ENDPOINT = 'https://vaultbank-ai.openai.azure.com/',
    DEPLOYMENT_NAME = 'gpt-4o',
    CREDENTIAL = [ManagedIdentityCredential],
    API_FORMAT = 'OPENAI'
);
💡 Scenario: Priya's model selection at Vault Bank

Priya needs three AI capabilities for the banking platform:

  1. Fraud detection — classify transactions as suspicious or legitimate. She chooses a small model (GPT-4o-mini) because it is fast and cheap for binary classification at high volume.
  2. Customer support summarisation — summarise complaint emails in English and Japanese. She chooses a multilingual medium model (GPT-4o) for balanced quality and language support.
  3. Semantic search — find similar customer queries. She chooses an embedding model (text-embedding-3-small) for generating vector representations.

Three different models, three different use cases — each optimised for its task.

Question

What is an external model in SQL Server?

Click or press Enter to reveal answer

Answer

A database object (CREATE EXTERNAL MODEL) that registers an AI model endpoint — like Azure OpenAI or Microsoft Foundry. It stores the endpoint URL, deployment name, authentication, and model type so T-SQL code can invoke the model directly.

Click to flip back

Question

Why is structured output important for SQL + AI integration?

Click or press Enter to reveal answer

Answer

When calling AI models from T-SQL, responses must be parseable to extract values into table columns. Structured output (JSON mode) ensures the model returns consistent, machine-readable formats instead of free-form text that is difficult to parse reliably.

Click to flip back

Question

What are the main model types used in SQL AI solutions?

Click or press Enter to reveal answer

Answer

Three types: COMPLETIONS (text generation, Q&A, summarisation), EMBEDDINGS (generate vector representations for semantic search), and MULTIMODAL (process text + images together). Choose based on your use case: search uses embeddings, RAG uses completions.

Click to flip back

Knowledge Check

Leo at SearchWave needs to add semantic product search. The system must generate vector embeddings for 2 million product descriptions nightly, and latency per embedding must be under 50ms. Which model choice is best?

🎬 Video coming soon

Next up: Embeddings: Design, Chunk, and Generate — turn your data into vectors that AI can search and compare.

← Previous

Azure Integration and Monitoring

Next →

Embeddings: Design, Chunk, and Generate

Guided

I learn, I simplify, I share.

A Guide to Cloud YouTube Feedback

© 2026 Sutheesh. All rights reserved.

Guided is an independent study resource and is not affiliated with, endorsed by, or officially connected to Microsoft. Microsoft, Azure, and related trademarks are property of Microsoft Corporation. Always verify information against Microsoft Learn.