Tag: Stored Procedures

Expose database objects, stored procedures, and views, including GraphQL relationships (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Secure, optimize, and deploy database solutions (35–40%)
   --> Integrate SQL solutions with Azure services
      --> Expose database objects, stored procedures, and views, including GraphQL relationships


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Modern applications rarely communicate directly with a database. Instead, they interact with APIs that expose only the data and operations that applications require. Microsoft’s Data API builder (DAB) provides a secure and efficient way to expose Azure SQL Database, Azure SQL Managed Instance, SQL Server, and Azure Database for PostgreSQL as REST and GraphQL APIs without requiring developers to build custom API services.

One of the primary responsibilities of a SQL AI Developer is deciding which database objects should be exposed, how they should be exposed, and how relationships between entities should be represented, particularly in GraphQL.

For the DP-800 exam, candidates should understand how to expose:

  • Tables
  • Views
  • Stored procedures
  • Relationships between entities
  • GraphQL navigation
  • REST resources
  • Security considerations
  • Performance considerations

Why Expose Database Objects?

Instead of allowing applications to connect directly to a database, organizations commonly expose selected database objects through APIs because APIs provide:

  • Better security
  • Controlled access
  • Versioning
  • Authentication
  • Authorization
  • Business logic abstraction
  • Simplified client development

Rather than allowing direct SQL access, applications interact with HTTP endpoints such as:

GET /api/Products

or GraphQL queries like:

query {
products {
ProductID
Name
Price
}
}

Objects That Can Be Exposed

Microsoft Data API builder can expose several database object types.

1. Tables

Tables are the most common objects exposed.

Example:

Products
Customers
Orders
Employees

Each table becomes an entity.

Example DAB configuration:

{
"entities": {
"Products": {
"source": "Products"
}
}
}

REST endpoints generated:

GET /api/Products
POST /api/Products
PATCH /api/Products
DELETE /api/Products

GraphQL automatically generates:

products
product_by_pk

and corresponding mutations.


2. Views

Views provide a secure way to expose pre-filtered or joined data.

Example:

vwSalesSummary

Instead of exposing many tables, clients consume the view.

Benefits include:

  • Simplified queries
  • Hidden table structure
  • Security abstraction
  • Read-only reporting

Example:

CustomerName
OrderCount
TotalSales

instead of requiring joins.

Views are especially useful for reporting applications.


3. Stored Procedures

Stored procedures expose business logic rather than raw tables.

Example:

EXEC usp_CreateOrder

Instead of allowing clients to insert rows manually.

Advantages include:

  • Validation
  • Business rules
  • Transactions
  • Consistent processing

Data API builder supports stored procedures as API operations.

Example REST endpoint:

POST /api/CreateOrder

Why Use Stored Procedures?

Stored procedures provide:

  • Better security
  • Centralized business rules
  • Reduced network traffic
  • Transaction handling
  • Parameter validation

Example:

Instead of:

Insert Order
Insert Items
Update Inventory
Calculate Discount
Commit Transaction

The application calls:

CreateOrder()

The stored procedure performs every operation safely.


Exposing Views vs Tables

TablesViews
Raw dataProcessed data
Often updateableOften read-only
Complete schemaSimplified schema
Less abstractionGreater abstraction
Better for CRUDBetter for reporting

Exposing Stored Procedures

Stored procedures typically become REST POST operations because they execute actions.

Example:

POST
/api/ProcessPayment

Input:

{
"OrderID":1054
}

The procedure performs the transaction.


GraphQL Relationships

One of GraphQL’s greatest advantages is navigating relationships between entities.

Instead of making several REST calls:

Customers
Orders
OrderDetails

GraphQL can retrieve all related information in one request.

Example:

query {
customers {
CustomerName
orders {
OrderID
OrderDate
orderDetails {
ProductName
Quantity
}
}
}

GraphQL traverses relationships automatically.


Understanding Relationships

Suppose the database contains:

Customers
Orders
Products
OrderDetails

Relationships:

Customer
|
| 1:M
|
Orders
|
| 1:M
|
OrderDetails
|
| M:1
|
Products

GraphQL follows these relationships naturally.


One-to-Many Relationships

Example:

Customer

Orders

Example query:

query{
customers{
CustomerName
orders{
OrderID
OrderDate
}
}
}

The response includes each customer’s orders.


Many-to-One Relationships

Example:

OrderDetails

Product

query{
orderDetails{
Quantity
product{
Name
Price
}
}
}

Many-to-Many Relationships

Many-to-many relationships are typically implemented through junction tables.

Example:

Students
Courses
StudentCourses

GraphQL can expose navigation through the junction table.


REST vs GraphQL for Relationships

REST

GET Customers
GET Orders
GET OrderDetails

Multiple requests required.

GraphQL

One query retrieves everything.

Advantages:

  • Reduced network traffic
  • Less over-fetching
  • Less under-fetching
  • Better performance

Relationship Configuration in Data API Builder

Relationships are defined inside the configuration.

Example concept:

Customers
hasMany
Orders

and

Orders
belongsTo
Customers

This allows nested GraphQL queries.


CRUD Support

Depending on configuration, exposed entities may support:

Create

POST

Read

GET

Update

PUT
PATCH

Delete

DELETE

Not every entity must support every operation.

For example:

Views

Read Only

Tables

Read + Write

Restricting Exposed Objects

Best practice is not to expose every table.

Expose only:

  • Required tables
  • Required views
  • Required procedures

Avoid exposing:

  • Audit tables
  • Internal configuration
  • Security tables
  • Temporary tables
  • Logging tables

Least privilege always applies.


Security Considerations

When exposing database objects:

  • Require HTTPS
  • Use Microsoft Entra authentication
  • Apply least privilege
  • Use role-based authorization
  • Expose only necessary objects
  • Validate procedure parameters
  • Avoid exposing sensitive columns
  • Audit endpoint usage

Performance Considerations

Good API design includes:

  • Return only needed fields
  • Use pagination
  • Cache reference data
  • Optimize SQL queries
  • Index frequently queried columns
  • Avoid unnecessary nested GraphQL queries
  • Use views for complex reporting

Common DP-800 Exam Tips

Know when to expose:

ObjectTypical Use
TableCRUD operations
ViewReporting and simplified queries
Stored ProcedureBusiness logic and transactions
GraphQL RelationshipNested related data
REST EndpointResource-oriented operations

Summary

For the DP-800 exam, you should understand that Data API builder can expose tables, views, and stored procedures as secure REST and GraphQL endpoints. Tables are commonly used for CRUD operations, views simplify reporting and hide underlying schemas, and stored procedures encapsulate business logic and transactional operations. GraphQL relationships allow clients to traverse related entities in a single request, reducing network calls and simplifying application development. Developers should expose only the objects required by the application, apply least-privilege security principles, and optimize endpoints for performance and maintainability.


Practice Exam Questions

Question 1

Your organization wants external applications to retrieve product information without exposing the underlying table structure or requiring complex joins. Which database object should you expose?

A. A view

B. A database trigger

C. A SQL Agent job

D. A temporary table

Correct Answer:

A. A view

Explanation

Views present a simplified, controlled representation of data by encapsulating joins and filters. They hide the underlying schema, making them ideal for reporting and read-only access. Triggers, SQL Agent jobs, and temporary tables are not intended to expose data to applications.


Question 2

Which type of database object is best suited for encapsulating business logic that performs multiple database operations within a single transaction?

A. A view

B. A stored procedure

C. A synonym

D. An index

Correct Answer:

B. A stored procedure

Explanation

Stored procedures centralize business logic, validate inputs, manage transactions, and execute multiple SQL statements as a single unit of work. Views are primarily for querying data, while synonyms and indexes do not execute business logic.


Question 3

An application uses GraphQL to retrieve customer information and all associated orders in a single request.

Which GraphQL capability makes this possible?

A. Automatic indexing

B. HTTP caching

C. Entity relationships

D. SQL triggers

Correct Answer:

C. Entity relationships

Explanation

GraphQL relationships allow clients to traverse related entities through nested queries, enabling retrieval of customers and their orders in a single request. This is one of GraphQL’s primary advantages over traditional REST APIs.


Question 4

A developer exposes a database table through Data API builder and wants clients to retrieve records using REST.

Which HTTP method should clients use?

A. DELETE

B. PATCH

C. POST

D. GET

Correct Answer:

D. GET

Explanation

REST uses the GET method to retrieve resources. POST creates resources, PATCH updates existing resources, and DELETE removes resources.


Question 5

Which object is most appropriate for exposing aggregated sales totals without allowing users to modify the underlying data?

A. A stored procedure

B. A table

C. A view

D. A trigger

Correct Answer:

C. A view

Explanation

Views are commonly used to expose aggregated or summarized information while hiding the complexity of the underlying tables. Many reporting views are read-only, preventing accidental modifications.


Question 6

A Data API builder configuration includes only the Products and Categories entities.

What happens if a client attempts to access the Employees table?

A. The request succeeds because all tables are exposed automatically.

B. The table is exposed only through GraphQL.

C. The request fails because Employees is not configured as an exposed entity.

D. Data API builder creates the endpoint automatically.

Correct Answer:

C. The request fails because Employees is not configured as an exposed entity.

Explanation

Data API builder exposes only the entities explicitly defined in its configuration. Objects not configured remain inaccessible through both REST and GraphQL endpoints.


Question 7

Why should developers avoid exposing every database table through REST or GraphQL endpoints?

A. Because GraphQL cannot access multiple tables.

B. To follow the principle of least privilege and reduce security risks.

C. Because Data API builder supports only five entities.

D. To improve SQL syntax compatibility.

Correct Answer:

B. To follow the principle of least privilege and reduce security risks.

Explanation

Exposing only required objects reduces the attack surface, protects sensitive data, and aligns with security best practices. Internal, audit, configuration, and security tables should generally remain inaccessible.


Question 8

Which GraphQL feature reduces the need for multiple REST API calls when retrieving related data?

A. Stored procedures

B. Pagination

C. HTTP status codes

D. Nested queries using relationships

Correct Answer:

D. Nested queries using relationships

Explanation

GraphQL allows nested queries that follow entity relationships, enabling clients to retrieve related objects in a single request. This minimizes network traffic and simplifies application development.


Question 9

Which database object is generally the best choice for exposing an operation that validates inventory, creates an order, updates stock levels, and commits the transaction?

A. A stored procedure

B. A view

C. A nonclustered index

D. A foreign key

Correct Answer:

A. A stored procedure

Explanation

Stored procedures encapsulate complex business processes, ensure transactional consistency, and centralize business rules. Views and indexes cannot perform transactional workflows.


Question 10

A GraphQL query retrieves customer information along with orders and order details.

What is the primary benefit of this approach compared to making several REST requests?

A. SQL Server automatically creates indexes.

B. Database permissions are no longer required.

C. Authentication becomes optional.

D. Multiple related resources can be retrieved in a single request, reducing network overhead.

Correct Answer:

D. Multiple related resources can be retrieved in a single request, reducing network overhead.

Explanation

GraphQL enables clients to retrieve exactly the required data—including related entities—in a single query. This reduces round trips, minimizes over-fetching and under-fetching, and often improves application performance.


Go to the DP-800 Exam Prep Hub main page

Create stored procedures (DP-800 Exam Prep)

This post is a part of the DP-800: Developing AI-Enabled Database Solutions Exam Prep Hub.
This topic falls under these sections:
Design and develop database solutions (35–40%)
   --> Implement programmability objects
      --> Create stored procedures


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Stored procedures are one of the most powerful programmability objects available in SQL Server and Azure SQL Database. A stored procedure is a precompiled collection of one or more Transact-SQL (T-SQL) statements that perform a specific task. Stored procedures allow developers to encapsulate business logic, automate repetitive database operations, improve application security, and optimize performance.

Stored procedures are widely used in enterprise applications for Create, Read, Update, Delete (CRUD) operations, reporting, data validation, data processing, ETL workflows, auditing, and integrating applications with databases. They are also valuable in AI-enabled database solutions where they can orchestrate data preparation, invoke AI-related operations, and manage workflows that interact with vector data, embeddings, and Retrieval-Augmented Generation (RAG) pipelines.

For the DP-800: Developing AI-Enabled Database Solutions certification exam, you should understand:

  • What stored procedures are
  • How to create, alter, execute, and delete stored procedures
  • Input and output parameters
  • Returning result sets and status codes
  • Error handling
  • Transactions
  • Dynamic SQL
  • Temporary objects
  • Security considerations
  • Performance optimization
  • Best practices

Understanding stored procedures is essential because they are one of the primary methods for implementing reusable business logic in SQL Server.


What Is a Stored Procedure?

A stored procedure is a named database object that contains one or more SQL statements that execute as a unit.

Unlike functions, stored procedures:

  • Can return zero, one, or multiple result sets
  • Can modify database data
  • Can execute DDL and DML statements
  • Can contain transactions
  • Can execute dynamic SQL
  • Can include error handling
  • Can call other stored procedures

Stored procedures are stored within the database and executed on demand.


Benefits of Stored Procedures

Stored procedures provide numerous advantages:

  • Encapsulate business logic
  • Reduce duplicate SQL code
  • Improve security
  • Simplify application development
  • Improve maintainability
  • Reduce network traffic
  • Support transaction management
  • Improve performance through execution plan reuse
  • Simplify administrative operations

Creating a Stored Procedure

Basic syntax:

CREATE PROCEDURE dbo.uspGetCustomers
AS
BEGIN
SELECT
CustomerID,
CustomerName,
City
FROM Sales.Customers;
END;

Execute the procedure:

EXEC dbo.uspGetCustomers;

or

EXECUTE dbo.uspGetCustomers;

Creating a Stored Procedure with Parameters

Most stored procedures accept one or more parameters.

Example:

CREATE PROCEDURE dbo.uspGetCustomerOrders
(
@CustomerID INT
)
AS
BEGIN
SELECT
OrderID,
OrderDate,
TotalAmount
FROM Sales.Orders
WHERE CustomerID = @CustomerID;
END;

Execute:

EXEC dbo.uspGetCustomerOrders
@CustomerID = 100;

Parameters make procedures reusable across many scenarios.


Using Multiple Parameters

Example:

CREATE PROCEDURE dbo.uspOrdersByDate
(
@StartDate DATE,
@EndDate DATE
)
AS
BEGIN
SELECT *
FROM Sales.Orders
WHERE OrderDate BETWEEN @StartDate AND @EndDate;
END;

Optional Parameters

Parameters may have default values.

Example:

CREATE PROCEDURE dbo.uspGetOrders
(
@Status VARCHAR(20) = 'Open'
)
AS
BEGIN
SELECT *
FROM Sales.Orders
WHERE Status = @Status;
END;

Now the procedure can be executed with or without specifying the parameter.


Output Parameters

Stored procedures can return values through output parameters.

Example:

CREATE PROCEDURE dbo.uspGetOrderCount
(
@CustomerID INT,
@OrderCount INT OUTPUT
)
AS
BEGIN
SELECT
@OrderCount = COUNT(*)
FROM Sales.Orders
WHERE CustomerID = @CustomerID;
END;

Execution:

DECLARE @Count INT;
EXEC dbo.uspGetOrderCount
@CustomerID = 100,
@OrderCount = @Count OUTPUT;
SELECT @Count;

Returning Status Codes

Stored procedures may return an integer status code.

Example:

CREATE PROCEDURE dbo.uspExample
AS
BEGIN
RETURN 0;
END;

Execution:

DECLARE @ReturnCode INT;
EXEC @ReturnCode = dbo.uspExample;
SELECT @ReturnCode;

A return code is commonly used to indicate success or failure.


Returning Result Sets

Stored procedures frequently return result sets.

Example:

CREATE PROCEDURE dbo.uspTopCustomers
AS
BEGIN
SELECT TOP (10)
CustomerName,
TotalSales
FROM Sales.CustomerTotals
ORDER BY TotalSales DESC;
END;

Applications can consume the returned rows directly.


Data Modification

Stored procedures commonly perform INSERT, UPDATE, DELETE, and MERGE operations.

Example:

CREATE PROCEDURE dbo.uspInsertCustomer
(
@CustomerName NVARCHAR(100),
@City NVARCHAR(50)
)
AS
BEGIN
INSERT INTO Sales.Customers
(
CustomerName,
City
)
VALUES
(
@CustomerName,
@City
);
END;

Using Transactions

Stored procedures frequently include explicit transactions.

Example:

CREATE PROCEDURE dbo.uspTransferFunds
AS
BEGIN
BEGIN TRANSACTION;
-- Debit account
-- Credit account
COMMIT TRANSACTION;
END;

Transactions ensure that all related operations either succeed together or fail together.


Error Handling

SQL Server supports structured error handling with TRY...CATCH.

Example:

CREATE PROCEDURE dbo.uspExample
AS
BEGIN
BEGIN TRY
SELECT 1/0;
END TRY
BEGIN CATCH
SELECT ERROR_MESSAGE();
END CATCH
END;

Functions cannot use TRY...CATCH, making this an important distinction between stored procedures and functions.


Dynamic SQL

Stored procedures can execute dynamic SQL.

Example:

CREATE PROCEDURE dbo.uspDynamicSearch
(
@TableName SYSNAME
)
AS
BEGIN
DECLARE @SQL NVARCHAR(MAX);
SET @SQL =
N'SELECT * FROM ' + QUOTENAME(@TableName);
EXEC sp_executesql @SQL;
END;

Using sp_executesql is generally preferred over EXEC() because it supports parameterization and helps reduce SQL injection risks.


Temporary Tables

Stored procedures often use temporary tables.

Example:

CREATE PROCEDURE dbo.uspSalesReport
AS
BEGIN
CREATE TABLE #Sales
(
OrderID INT,
Total MONEY
);
INSERT INTO #Sales
SELECT
OrderID,
TotalAmount
FROM Sales.Orders;
SELECT *
FROM #Sales;
END;

Temporary tables exist only during the session or procedure execution.


Table Variables

Stored procedures may also use table variables.

Example:

DECLARE @Orders TABLE
(
OrderID INT,
Total MONEY
);

Table variables are useful for storing smaller intermediate result sets.


Modifying a Stored Procedure

Use ALTER PROCEDURE.

Example:

ALTER PROCEDURE dbo.uspGetCustomers
AS
BEGIN
SELECT
CustomerID,
CustomerName,
City,
Country
FROM Sales.Customers;
END;

Deleting a Stored Procedure

Use:

DROP PROCEDURE dbo.uspGetCustomers;

Viewing a Stored Procedure Definition

Developers can inspect a procedure using:

sp_helptext 'dbo.uspGetCustomers';

or

SELECT OBJECT_DEFINITION
(
OBJECT_ID('dbo.uspGetCustomers')
);

Stored Procedures vs. Functions

FeatureStored ProcedureFunction
Returns a tableMay return result setsTable-valued functions only
Returns a scalar valueVia OUTPUT or RETURNScalar functions return one value
Used in SELECTNoYes (functions)
Can modify dataYesLimited; functions cannot modify permanent user tables
Supports transactionsYesNo
Supports TRY…CATCHYesNo
Supports dynamic SQLYesNo

Stored Procedures vs. Views

FeatureStored ProcedureView
Accepts parametersYesNo
Modifies dataYesNo (except through updatable views under certain conditions)
Contains procedural logicYesNo
Executes transactionsYesNo

Security Benefits

Stored procedures improve security by:

  • Granting EXECUTE permission instead of direct table access
  • Encapsulating sensitive business rules
  • Reducing the application’s need for elevated privileges
  • Supporting ownership chaining in many scenarios
  • Helping minimize SQL injection risks through parameterized queries

Performance Considerations

Stored procedures often improve performance because:

  • Execution plans can be reused.
  • SQL is compiled and optimized by the query optimizer.
  • Network traffic is reduced because only the procedure call is transmitted.
  • Business logic executes close to the data.

However, developers should also understand parameter sniffing, where SQL Server creates an execution plan based on the parameter values supplied during compilation. In some cases, this plan may not be optimal for different parameter values. Techniques such as OPTION (RECOMPILE), OPTIMIZE FOR, or carefully designed query patterns may help address parameter-sensitive performance issues.


AI-Enabled Database Scenarios

Stored procedures play an important role in AI-enabled database solutions.

Examples include:

  • Preparing data before generating embeddings
  • Coordinating vector insert and update operations
  • Executing intelligent search workflows
  • Managing Retrieval-Augmented Generation (RAG) data preparation
  • Orchestrating multi-step AI pipelines
  • Logging AI requests and responses
  • Performing batch updates for AI-generated content
  • Calling Azure services from application workflows that interact with the database

Stored procedures provide a reliable way to centralize business logic that supports AI applications.


Best Practices

  • Use descriptive names such as uspGetCustomerOrders.
  • Keep procedures focused on a single responsibility.
  • Use parameterized queries whenever possible.
  • Prefer sp_executesql over concatenated dynamic SQL.
  • Include proper error handling with TRY...CATCH.
  • Use transactions only when necessary and keep them as short as possible.
  • Return only the data that callers require.
  • Document business logic clearly.
  • Test procedures with realistic workloads.
  • Monitor execution plans and optimize when needed.

Common Exam Tips

For the DP-800 exam, remember these key points:

  • Stored procedures encapsulate reusable business logic.
  • Procedures can accept input parameters and output parameters.
  • They can return one or more result sets.
  • They support transactions, dynamic SQL, and error handling.
  • CREATE PROCEDURE creates a procedure.
  • ALTER PROCEDURE modifies an existing procedure.
  • DROP PROCEDURE removes a procedure.
  • Stored procedures can modify database data.
  • Procedures cannot be referenced directly in the FROM clause like table-valued functions.
  • Stored procedures are commonly used for CRUD operations, reporting, ETL, and AI workflow orchestration.

Practice Exam Questions

Question 1

A developer needs a reusable database object that can contain multiple SQL statements, modify data, and execute transactions. Which object should be created?

A. View

B. Scalar function

C. Stored procedure

D. Table-valued function

Answer: C

Explanation: Stored procedures are designed to encapsulate reusable business logic, modify data, execute transactions, and perform procedural operations.


Question 2

Which statement is used to execute an existing stored procedure?

A. EXEC

B. RUN

C. CALLPROC

D. EXECUTEQUERY

Answer: A

Explanation: SQL Server executes stored procedures using EXEC or its equivalent keyword EXECUTE.


Question 3

A stored procedure needs to return a calculated value to the calling application without including it in a result set. Which feature should be used?

A. CHECK constraint

B. OUTPUT parameter

C. DEFAULT constraint

D. Computed column

Answer: B

Explanation: OUTPUT parameters allow a stored procedure to return one or more values directly to the caller in addition to any result sets.


Question 4

Which capability is supported by stored procedures but not by user-defined functions?

A. Accepting parameters

B. Returning values

C. Executing TRY...CATCH error handling

D. Being stored in the database

Answer: C

Explanation: Stored procedures support structured error handling with TRY...CATCH, whereas user-defined functions do not.


Question 5

A developer needs to generate SQL statements dynamically while minimizing SQL injection risks. Which approach is recommended?

A. Use concatenated SQL with EXEC()

B. Store SQL in a view

C. Use a scalar function

D. Use sp_executesql with parameters

Answer: D

Explanation: sp_executesql supports parameterized dynamic SQL, improving security and enabling better plan reuse.


Question 6

Which statement modifies an existing stored procedure?

A. MODIFY PROCEDURE

B. ALTER PROCEDURE

C. UPDATE PROCEDURE

D. CHANGE PROCEDURE

Answer: B

Explanation: ALTER PROCEDURE changes the definition of an existing stored procedure without dropping and recreating it.


Question 7

Which statement about stored procedures is correct?

A. They can be referenced directly in the FROM clause of a SELECT statement.

B. They cannot accept parameters.

C. They can contain transactions and modify database data.

D. They always return exactly one scalar value.

Answer: C

Explanation: Stored procedures support transactions, data modification, and complex procedural logic. They cannot be queried directly in the FROM clause.


Question 8

What is parameter sniffing?

A. Encrypting stored procedure parameters.

B. Automatically validating parameter data types.

C. Caching parameter values for auditing.

D. Creating an execution plan based on parameter values supplied during compilation, which may not always be optimal for future executions.

Answer: D

Explanation: Parameter sniffing occurs when SQL Server optimizes a query using the initial parameter values, which can lead to less efficient plans for different parameter values.


Question 9

Which security benefit is commonly associated with stored procedures?

A. They automatically encrypt all stored data.

B. They eliminate the need for authentication.

C. They prevent all SQL injection attacks regardless of implementation.

D. They allow users to receive EXECUTE permission without requiring direct access to underlying tables.

Answer: D

Explanation: Granting EXECUTE permission on stored procedures helps restrict direct access to tables while encapsulating business logic and access patterns.


Question 10

How are stored procedures commonly used in AI-enabled database solutions?

A. They automatically generate embeddings without application logic.

B. They replace vector indexes.

C. They orchestrate reusable workflows such as preparing data, managing vector operations, logging AI activity, and supporting Retrieval-Augmented Generation (RAG) pipelines.

D. They eliminate the need for application code.

Answer: C

Explanation: Stored procedures centralize business logic and coordinate multi-step operations, making them well suited for AI-related workflows that prepare data, manage vectors, and support RAG processes.


Go to the DP-800 Exam Prep Hub main page