Have picked up someone's code and this is a part of a where clause, anyone know what the double colon indicates?
b.date_completed > a.dc::date + INTERVAL '1 DAY 7:20:00'
Have picked up someone's code and this is a part of a where clause, anyone know what the double colon indicates?
b.date_completed > a.dc::date + INTERVAL '1 DAY 7:20:00'
It varies based on RDBMS, but if I guess right, that's PostgreSQL, in which case the
::
convertsa.dc
to a date type ofdate
.In other flavors...
In MS SQL Server 2000:
In MS SQL Server 2005:
However...
As well as...
Sources: BOL and Kalen Delaney's Blog
It is a
CAST
operation(cast to a date type).Example:
SELECT now()::timestamp(0);
Is equivalent to:
They both result in casting
now()
totimestamp
in the following format:YYYY-MM-DD HH:MM:SS
In this case, it is a cast to a date type. :: is a type cast that can also be represented as CAST(expression AS type).
It is probably a cast, converting
a.dc
to typedate
.IBM Informix Dynamic Server (IDS) would work that way - but the INTERVAL notation at the end is not valid for IDS, so presumably this is in fact another DBMS (probably PostgreSQL).