PrepAway - Latest Free Exam Questions & Answers

You have the following stored procedure that is called by other stored procedures and applications:

You have the following stored procedure that is called by other stored procedures and applications:



You need to modify the stored procedure to meet the following requirements:

  • Always return a value to the caller.
  • Return 0 if @Status is NULL.
  • Callers must be able to use @Status as a variable.

Which two actions should you perform? Each correct answer presents part of the solution.

NOTE: Each correct selection is worth one point.

A. Replace NULL values with 0. Add a PRINT statement to return @Status.

B. Add a RETURN statement.

C. Replace NULL values with 0. Add an output parameter to return @Status.

D. Replace NULL values with 0. Add a SELECT statement to return @Status.

E. Add a PRINT statement.

F. Add a SELECT statement to return @Status.

G. Add an output parameter to return @Status.

Explanation:

There are three ways of returning data from a procedure to a calling program: result sets, output parameters, and return codes.

References:

https://docs.microsoft.com/en-us/sql/relational-databases/stored-procedures/return-data-from-a-stored-procedure?view=sql-server-2017

One Comment on “You have the following stored procedure that is called by other stored procedures and applications:


Leave a Reply