Execute scalar with select
Previously, you created a scalar function named SumRideHrsDateRange(). Execute that function for the '3/1/2018'
through '3/10/2018'
date range by passing local date variables.
Diese Übung ist Teil des Kurses
Writing Functions and Stored Procedures in SQL Server
Anleitung zur Übung
- Create
@BeginDate
and@EndDate
variables of typedate
with values'3/1/2018'
and'3/10/2018'
. - Execute the
SumRideHrsDateRange()
function by passing@BeginDate
and@EndDate
variables. - Include
@BeginDate
and@EndDate
variables in yourSELECT
statement with the function result.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
-- Create @BeginDate
___ ___ AS date = '___'
-- Create @EndDate
___ ___ ___ ___ = '3/10/2018'
SELECT
-- Select @BeginDate
___ AS BeginDate,
-- Select @EndDate
___ AS EndDate,
-- Execute SumRideHrsDateRange()
dbo.___(___, ___) AS TotalRideHrs