当前位置:主页 > >

SQLServer 2005 和Oracle 语法的一点差异小结

时间:2021-02-07 14:49:40 | 栏目: | 点击:

1.获取系统当前时间
SQL Server 2005:
select getdate()
Oracle:
select sysdate from dual
2.获取年月日
SQL Server 2005:
复制代码 代码如下:

select year(getdate()) --2011
select month(getdate()) --3
select day(getdate()) --23

Oracle:
复制代码 代码如下:

select to_char(sysdate,'yyyy') from dual --2011
select to_char(sysdate,'mm') from dual --03
select to_char(sysdate,'dd') from dual --23
q 季度
hh 小时(12)
hh24 小时(24)
mi 分
ss 秒
D 周中的星期几

您可能感兴趣的文章:

相关文章