星期一, 十月 22, 2007

各种数据库取当前日期的写法与用途

proxool.house-keeping-test-sql=select getdate()

mysql select CURRENT_DATE()
mssql select getdate()
db2 SELECT CURRENT DATE FROM SYSIBM.SYSDUMMY1
oracle SELECT SYSDATE FROM DUAL

取当前日期各种数据库的写法
1. ORACLE
SELECT SYSDATE FROM DUAL
2. DB2
SELECT CURRENT TIMESTAMP FROM SYSIBM.SYSDUMMY1
3. INFORMIX
SELECT TODAY FROM TABLE
4. SQLSERVER
SELECT GETDATE() FROM TABLE
5. SQLSERVER
SELECT GETDATE() FROM TABLE
6. MYSQL
mysql> select now();
mysql> select sysdate();
mysql> select curdate();
mysql> select current_date;
mysql> select curtime();
mysql> select current_time;
7. FOXPRO
select DATE() from TABLE

没有评论: