LoslegenKostenlos loslegen

First day of month

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

Diese Übung ist Teil des Kurses

Writing Functions and Stored Procedures in SQL Server

Kurs anzeigen

Anleitung zur Übung

  • 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.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

-- Find the first day of the current month
SELECT ___(___, ___(___, 0, GETDATE()), ___)
Code bearbeiten und ausführen