Get DB2 current date for use in a query

Does anyone know how to retrieve the current date in DB2 so you could use that value in a query as if you hard coded the value? Our DBA says that by using an object called current date whose definition is simply select current date is very inefficient since it has to generate the value each time the row is evaluated in the query. The DBA suggested a singleton select against a 1 row table (to get current date or to do date math with current date) and then pass the result into other queries.


Listserv Archives (BOB member since 2002-06-25)

I hate to disagree with a DBA, but that should be the least of your worries. Most databases have a simple function that reads the system date. Sysdate() or Getdate() shouldn’t hurt your performance.


Listserv Archives (BOB member since 2002-06-25)