Posts tagged ‘Date’

T-SQL: Mit Daten rechnen

Hier eine Übersicht zum Errechnen von Datumswerten in T-SQL

Datum SQL
Today getdate()
Yesterday DATEADD(day, -1, CAST(GETDATE()))
Tomorrow DATEADD(day, 1, CAST(GETDATE()))
First day of the previous month DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE())-1, 0)
Last day of the previous month DATEADD(MONTH, DATEDIFF(MONTH, -1, GETDATE())-1, -1) --Last Day of previous month

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website