Databases: date and time functions

Databases: date and time functions

Door: Arnout van der Vorst

Unfortunately databases don’t all use the same SQL language. In most cases, the notation of SQL queries is roughly the same, however in some cases there are differences, for instance when working with dates and times:

  • SQL Server: getdate()
  • Oracle: sysdate
  • Solid: now()
  • mySQL: now()
  • Access: now

Calculation with dates on various databases also differs. SQL Server has the DateAdd funtion, Oracle has overloaded operators so you can use + to increase dates by default with a number of days. Solid has a particular notation: SELECT {fn timestampadd(SQL_TSI_DAY, 30, now())}, which gets us the current date + 30 days. mySQL uses a similar notation but doesn’t require the {fn} syntax:
SELECT TIMESTAMPADD(DAY, 30, now()).

Geschreven door:
Arnout van der Vorst

Arnout van der Vorst is Identity Management Architect bij Tools4ever en al ruim 10 jaar in dienst. Arnout legt zich als Architect toe op het bedenken en ontwikkelen van nieuwe features, oplossingen en diensten van Tools4ever die aansluiten op de vraag uit de markt. Arnout studeerde Hogere Informatica aan de Hogeschool van Utrecht.

Anderen bekeken ook

De vooroordelen van Single Sign On

De vooroordelen van Single Sign On

29 november 2011

RBAC: sleutelrol, beheer en evolutie

RBAC: sleutelrol, beheer en evolutie

15 maart 2011

SAP koppeling met Active Directory

SAP koppeling met Active Directory

06 september 2012

Single Sign On met terminal emulatie (VAX64, AS/400, Linux, SSH)

Single Sign On met terminal emulatie (VAX64, AS/400, Linux, SSH)

14 oktober 2010

User- en toegangsbeheer in cloud applicaties: een uitdaging

User- en toegangsbeheer in cloud applicaties: een uitdaging

04 september 2012