EXECUTE with return value
Execute dbo.cuspRideSummaryUpdate
to change the RideHours
to 300
for '3/1/2018'
. Store the return code from the stored procedure.
This exercise is part of the course
Writing Functions and Stored Procedures in SQL Server
Exercise instructions
- Declare
@ReturnStatus
as an integer and assign its value to the result ofdbo.cuspRideSummaryUpdate
. - Execute the stored procedure, setting
@DateParm
to'3/1/2018'
and@RideHrs
to300
. - Select the
@ReturnStatus
to see its value as well as the'3/1/2018'
record fromRideSummary
to see the impact of the SP update.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
-- Create @ReturnStatus
___ ___ AS int
-- Execute the SP, storing the result in @ReturnStatus
___ ___ = ___.___
-- Specify @DateParm
___ = '___',
-- Specify @RideHrs
___ = ___
-- Select the columns of interest
___
@ReturnStatus AS ReturnStatus,
Date,
RideHours
FROM ___.___
WHERE ___ = '3/1/2018';