Working with SQL Server Database Objects
Introducing Stored Procedures
ToyzUnlimited is a trendy toy store based in California. It buys toys from
manufacturers, stocks them in its store and sells them for profits. ToyzUnlimited
maintains the details of all branded toy products in a SQL Server 2005 database.
To speed up the day-to-day tasks and operations related to the database, it has
been decided to use SQL Server 2005 stored procedures for commonly
Product Code that uniquely
identifies each toy
Name of the toy
Category of the toy, such as for
example, block building, board
games, puzzles etc
Age range for the kids to use
the toy. Eg: 3-5 years
Price of the toy in dollars
Weight of the toy in grams
Table 7.1: Toys Table
1. Start with creating the table Toys. The structure of the table is described
above. Add at least 5 records to the table. Ensure that the value of the
column QtyOnHand is more than 20 for each of the toys.
2. Write statements to create a stored procedure named HeavyToys that will
list names of all the toys that are above 500 grams.
3. Write statements to create a stored procedure named PriceIncrease that
will increment the unitprice of all toys by 10 dollars.
4. Write statements to create a stored procedure QtyOnHand that will decrease
the quantity on hand of all toys by 5.
5. Execute the stored procedures HeavyToys, PriceIncrease and
6. In SQL Server Management Studio, locate the extended stored procedures
defined under the master database and execute the following procedures in a
© 2007 Aptech Ltd
Page 1 of 1