7 of 7 Paper No: 1
Picture 8.1
Question 9:
Create a store procedure named staff_order to count order of the staff where @staffid int is an input parameter and @countOrders int is an output parameter of the procedure.
For example, when we execute the procedure staff_order by using the following statements,the result should be as in the following figure:
declare @x int
exec staff_order 3, @x output
select @x as NumberOfOrders
Results NumberOfOrders
134
Messages
Picture 9.1
1
Question 10:
Create a function named OrderPrice to calculate the sum of list_price in table order_items,an input paramater is @orderld (int) and the output of the function is a decimal value.
For example, when we execute the function OrderPrice using the following statements, the result should be as in the following figure:
SELECT [dbo]. OrderPrice (3) AS sum_of_list_price
Results Messages
sum_of_list_price
1 1600
Picture 10.1
Zoom
+ 100%
Close