DATEPART/de
Jump to navigation
Jump to search
DATEPART(YEAR, d) | ||
---|---|---|
DBMS | OK | Alternative |
Ingres | Nein | EXTRACT(YEAR FROM d) |
MySQL | Nein | EXTRACT(YEAR FROM d) |
Oracle | Nein | EXTRACT(YEAR FROM d) |
PostgreSQL | Nein | EXTRACT(YEAR FROM d) |
SQL Server | Ja | DATEPART(YEAR, d) |
DATEPART
Mit DATEPART werden Teile eines Datumswertes ermittelt.
Es können Jahr (YEAR), Monat (MONTH), Tag (DAY), Stunde (HOUR), Minute (MINUTE) und Sekunde (SECOND) als Teil ermittelt werden.
DATEPART(YEAR, d) DATEPART(MONTH, d) DATEPART(DAY, d) DATEPART(HOUR, d) DATEPART(MINUTE, d) DATEPART(SECOND, d)
schema:gisq
In diesem Beispiel werden Jahr (YEAR) und Monat (MONTH) aus dem whn
-Datum ermittelt.
SELECT whn
,DATEPART(YEAR, whn) AS yr
,DATEPART(MONTH, whn) AS mnth
FROM eclipse
SELECT whn
,EXTRACT(YEAR FROM td) AS yr
,EXTRACT(MONTH FROM td) AS mnth
FROM gisq.eclipse
SELECT whn
,EXTRACT(YEAR FROM td) AS yr
,EXTRACT(MONTH FROM td) AS mnth
FROM eclipse
Siehe auch
Language: | [[:{{#invoke:String|sub|DATEPART/de
|1 |Expression error: Unrecognized punctuation character "{".}}|English]] |
---|