解决方法
根据他们的文档,以下供应商支持CURRENT_TIMESTAMP.
> Oracle
> Postgresql
> MySQL
> SQL Server
> Firebird
> H2
> HSQLDB
> DB2
> Vertica
> InterSystems Caché
> Doctrine
> Teradata
总之,CURRENT_TIMESTAMP是sql标准中规定的方法,其摘要如下所示,如果您正在寻找数据库不可知sql,那么您真正做的最好的就是坚持标准,尽管这并不能保证任何事情都会出现.完全DB不可知:
6.32< datetime value function>
指定一个函数,产生datetime类型的值.
格式
<current date value function> ::= CURRENT_DATE` <current time value function> ::= CURRENT_TIME [ <left paren> <time precision> <right paren> ] <current local time value function> ::= LOCALTIME [ <left paren> <time precision> <right paren> ] <current timestamp value function> ::= CURRENT_TIMESTAMP [ <left paren> <timestamp precision> <right paren> ] <current local timestamp value function> ::= LOCALTIMESTAMP [ <left paren> <timestamp precision> <right paren> ]
通用规则
1) The s CURRENT_DATE,CURRENT_TIME,and CURRENT_TIMESTAMP respectively return the current date,current time,and current timestamp; the time and timestamp values are returned with time zone displacement equal to the current default time zone displacement of the sqlsession.