Writing Your First Stored Procedure
This week, we'll look at various approaches to handling orders and the related order details records in the Northwind database. We'll use the Shopping Cart analogy used by most commerce Web sites, in which you can freely add and remove items from your "cart" (that is, your order) until you close the order. We will require five procedures:
Add an item to the cart
Remove an item from the cart
Display the contents of the cart
Cancel the order
Close the order
First, we'll write the first two procedures, and then you will write the next two as part of the exercises at the end of this lesson. We'll write the final procedure in Day 16, "Optimizing Stored Procedures."
In order to use the shopping cart method, we'll ...
Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.