带 OUTPUT 参数的 EXECUTE
执行存储过程 dbo.cuspSumRideHrsSingleDay,并捕获其输出参数。
本练习是课程的一部分
SQL Server 中的函数与存储过程编写
练习说明
- 将
@RideHrs声明为numeric类型的输出参数。 - 执行
dbo.cuspSumRideHrsSingleDay,并将'3/1/2018'作为@DateParm输入参数传入。 - 将输出参数的值存入
@RideHrs。 - 选择
@RideHrs,以显示该存储过程的输出参数值。
交互式实操练习
通过完成这段示例代码来试试这个练习。
-- Create @RideHrs
___ ___ AS ___(18,0)
-- Execute the stored procedure
___ dbo.___
-- Pass the input parameter
___ = '3/1/2018',
-- Store the output in @RideHrs
@RideHrsOut = ___ ___
-- Select @RideHrs
___ @RideHrs AS RideHours