Use SP to INSERT
Create a stored procedure named cusp_RideSummaryCreate in the dbo schema that will insert a record into the RideSummary table.
Diese Übung ist Teil des Kurses
<Kurs>Writing Functions and Stored Procedures in SQL Server</Kurs>Übungsanweisungen
- 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.
Interaktive praktische Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
-- 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;