1. 学习
  2. /
  3. 课程
  4. /
  5. Writing Functions and Stored Procedures in SQL Server

Connected

练习

DECLARE & CAST

Let's use DECLARE() and CAST() to combine a date variable and a time variable into a datetime variable.

说明

100 XP
  • Create a time variable named @ShiftStartTime and set initial value to '08:00 AM'.
  • Create a date variable named @StartDate and set it to the first StartDate from the BikeShare table.
  • Create a datetime variable named `@ShiftStartDateTime.
  • Change @StartDate and @ShiftStartTime to datetime data types and assign to @ShiftStartDateTime.