Use SP to INSERT
Create a stored procedure named cusp_RideSummaryCreate in the dbo schema that will insert a record into the RideSummary table.
Cet exercice fait partie du cours
Writing Functions and Stored Procedures in SQL Server
Instructions
- Define two input parameters named
@DateParmand@RideHrsParm. - Insert
@DateParmand@RideHrsParminto theDateandRideHourscolumns of theRideSummarytable. - Select the record that was just inserted where the Date is equal to
@DateParm.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
-- Create the stored procedure
CREATE PROCEDURE dbo.cusp_RideSummaryCreate
(___ date, ___ numeric)
AS
BEGIN
SET NOCOUNT ON
-- Insert into the Date and RideHours columns
INSERT ___ dbo.___(___, ___)
-- Use values of @DateParm and @RideHrsParm
___(___, ___)
-- Select the record that was just inserted
___
-- Select Date column
___,
-- Select RideHours column
___
FROM dbo.RideSummary
-- Check whether Date equals @DateParm
WHERE Date = @DateParm
END;