1. Learn
  2. /
  3. Courses
  4. /
  5. Writing Functions and Stored Procedures in SQL Server

Exercise

First day of month

Here you will use the GETDATE(), DATEDIFF(), and DATEADD() functions to find the first day of the current month.

Instructions

100 XP
  • Find the current date value.
  • Calculate the difference in months between today and 0 (1/1/1900 in SQL).
  • Add 0 months to that difference to get the first day of the month.