nerdexam
Microsoft

70-465 · Question #72

You need to recommend a solution for the error handling of USP_4. The solution must handle errors for nested stored procedures in the code for USP_4. What should you recommend?

The correct answer is C. Use the RAISERROR command in the nested stored procedures. To propagate errors from nested stored procedures up to the calling procedure (USP_4), the nested procedures must explicitly raise errors using RAISERROR so the caller can catch them.

Submitted by viktor_hu· Mar 5, 2026Design and implement database solutions for SQL Server

Question

You need to recommend a solution for the error handling of USP_4. The solution must handle errors for nested stored procedures in the code for USP_4. What should you recommend?

Options

  • AUse the @@ERROR variable in the nested stored procedures.
  • BUse the @@ERROR variable in USP_4.
  • CUse the RAISERROR command in the nested stored procedures.
  • DUse the RAISERROR command in USP_4.

How the community answered

(45 responses)
  • A
    4% (2)
  • B
    16% (7)
  • C
    71% (32)
  • D
    9% (4)

Why each option

To propagate errors from nested stored procedures up to the calling procedure (USP_4), the nested procedures must explicitly raise errors using RAISERROR so the caller can catch them.

AUse the @@ERROR variable in the nested stored procedures.

Using @@ERROR in the nested stored procedures only checks the error status locally within those procedures but does not propagate the error back to USP_4, so the calling procedure remains unaware of the failure.

BUse the @@ERROR variable in USP_4.

Checking @@ERROR in USP_4 alone will not capture errors that occur inside nested stored procedures, because those errors are scoped to the nested procedure's execution context and are not automatically visible to the caller.

CUse the RAISERROR command in the nested stored procedures.Correct

When nested stored procedures encounter errors, they must use RAISERROR to explicitly surface those errors to the calling procedure. Without RAISERROR in the nested procedures, errors occurring within them are silently swallowed and never propagated to USP_4's error handling logic. This ensures that TRY/CATCH blocks or @@ERROR checks in USP_4 can actually detect and respond to failures originating in the nested calls.

DUse the RAISERROR command in USP_4.

Using RAISERROR only in USP_4 does nothing to surface errors that originate within the nested stored procedures, since those errors never reach USP_4 unless the nested procedures explicitly raise them first.

Concept tested: Error propagation from nested stored procedures using RAISERROR

Source: https://learn.microsoft.com/en-us/sql/t-sql/language-elements/raiserror-transact-sql

Topics

#T-SQL error handling#RAISERROR#Nested stored procedures

Community Discussion

No community discussion yet for this question.

Full 70-465 Practice