ComenzarEmpieza gratis

Use SP to INSERT

Create a stored procedure named cusp_RideSummaryCreate in the dbo schema that will insert a record into the RideSummary table.

Este ejercicio forma parte del curso

Writing Functions and Stored Procedures in SQL Server

Ver curso

Instrucciones del ejercicio

  • Define two input parameters named @DateParm and @RideHrsParm.
  • Insert @DateParm and @RideHrsParm into the Date and RideHours columns of the RideSummary table.
  • Select the record that was just inserted where the Date is equal to @DateParm.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

-- 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;
Editar y ejecutar código