PrepAway - Latest Free Exam Questions & Answers

Which Transact-SQL statement or statements should you use?

You develop a Microsoft SQL Server 2012 database.
You need to create and call a stored procedure that meets the following requirements:
Accepts a single input parameter for CustomerID.
Returns a single integer to the calling application.
Which Transact-SQL statement or statements should you use? (Each correct answer presents part of
the solution. Choose all that apply.)

PrepAway - Latest Free Exam Questions & Answers

A.
CREATE PROCEDURE dbo.GetCustomerRating @Customer INT, @CustomerRatIng INT OUTPUT
AS
SET NOCOUNT ON SELECT @CustomerRating = CustomerOrders/CustomerValue
FROM Customers WHERE CustomerID = @CustomerID
RETURN
GO

B.
EXECUTE dbo.GetCustomerRatIng 1745

C.
DECLARE @customerRatingBycustomer INT
DECLARE @Result INT
EXECUTE @Result = dbo.GetCustomerRating
1745
, @CustomerRatingSyCustomer

D.
CREATE PROCEDURE dbo.GetCustomerRating @CustomerID INT, @CustomerRating INT OUTPUT
AS
SET NOCOUNT ON
SELECT @Result = CustomerOrders/CustomerValue
FROM Customers WHERE CustomerID = @CustomeriD
RETURN @Result
GO

E.
DECLARE @CustomerRatIngByCustcmer INT
EXECUTE dbo.GetCustomerRating @CustomerID = 1745,
@CustomerRating = @CustomerRatingByCustomer OUTPUT

F.
CREATE PROCEDURE dbo.GetCustomerRating
@CustomerID INT
AS
DECLARE @Result INT
SET NOCOUNT ON
SELECT @Result = CustomerOrders/CustomerVaLue
FROM Customers
WHERE Customer= = @CustomerID
RETURNS @Result

8 Comments on “Which Transact-SQL statement or statements should you use?

  1. Mark says:

    It is saying that the answer as a whole (defining the SP and execution of the SP) is split in more than one part.
    A is the correct definition (with the output param)
    E is the correct way of executing the SP (declaring the catching parameter, referencing it in the output parameter)




    0



    0
  2. Mohamed ALi says:

    There is a mistake on the answer the input param is
    @Customer INT without ID
    in the where clause we are using @CustomerID

    maybe it’s just a copy paste error




    0



    0

Leave a Reply