Workshop

The Workshop provides quiz questions to help you solidify your understanding of the material covered and exercises to provide you with experience in using what you've learned. Try to answer the quiz and exercise questions before checking the answers in Appendix A, "Answers to Quizzes and Exercises," and make sure you understand the answers before continuing to the next lesson.

Quiz

1: What is the correct method to return a data value to a calling program?
2: I have the following procedure and batch, but when I run the batch, the value of @out_x is always null. What's wrong?
create procedure p1 (@x int output)
as
select @x = 1
return

declare @out_x int
execute p1 @out_x
select @out_x

3: In this procedure and batch, my return status is always null. Why?
create procedure p2
as
declare @x int
select @x = 1
if @x = 1
   return 1
else
   return 0

declare @retstat int
execute p2
select @retstat "return"

4: How do I get a list of parameters for a procedure?

Exercises

1: Write a stored procedure to display the contents of the shopping cart for a customer. Call the prGetCustomerCart procedure in your procedure.
2: Write a stored procedure to delete the current shopping cart for a customer. Delete both the order details and the order itself.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset