EXECUTE พร้อมค่าที่ส่งกลับ
รัน dbo.cuspRideSummaryUpdate เพื่อเปลี่ยน RideHours เป็น 300 สำหรับวันที่ '3/1/2018' แล้วเก็บค่า return code ที่ได้จาก stored procedure
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
การเขียนฟังก์ชันและ Stored Procedures ใน SQL Server
คำแนะนำการฝึกหัด
- ประกาศ
@ReturnStatusเป็น integer และกำหนดค่าให้เท่ากับผลลัพธ์ที่ได้จากdbo.cuspRideSummaryUpdate - รัน stored procedure โดยตั้งค่า
@DateParmเป็น'3/1/2018'และ@RideHrsเป็น300 - SELECT
@ReturnStatusเพื่อดูค่าที่ได้ รวมถึงดึงข้อมูลของวันที่'3/1/2018'จากRideSummaryเพื่อตรวจสอบผลลัพธ์หลังจาก SP อัปเดตแล้ว
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
-- Create @ReturnStatus
___ ___ AS int
-- Execute the SP, storing the result in @ReturnStatus
___ ___ = ___.___
-- Specify @DateParm
___ = '___',
-- Specify @RideHrs
___ = ___
-- Select the columns of interest
___
@ReturnStatus AS ReturnStatus,
Date,
RideHours
FROM ___.___
WHERE ___ = '3/1/2018';