当前位置: 代码迷 >> SQL >> SQL 数据库,该怎么处理
  详细解决方案

SQL 数据库,该怎么处理

热度:866   发布时间:2016-05-05 15:35:29.0
SQL 数据库
数据库中查询时间精确到秒 方法是什么?

------解决方案--------------------
SQL code
1> select2>      DATEPART ( year , getdate() ) as year,3>      DATEPART ( month , getdate() ) as month,4>      DATEPART ( day , getdate() ) as day,5>      DATEPART ( hour , getdate() ) as hour,6>      DATEPART ( minute , getdate() ) as minute,7>      DATEPART ( second , getdate() ) as second,8>      DATEPART ( millisecond , getdate() ) as millisecond9>10> goyear       |month      |day        |hour       |minute     |second     |millisecond-----------|-----------|-----------|-----------|-----------|-----------|-----------       2010|          9|         24|         17|         30|         56|647(1 rows affected)1>
------解决方案--------------------
1> select
2> DATEPART ( year , getdate() ) as year,
3> DATEPART ( month , getdate() ) as month,
4> DATEPART ( day , getdate() ) as day,
5> DATEPART ( hour , getdate() ) as hour,
6> DATEPART ( minute , getdate() ) as minute,
7> DATEPART ( second , getdate() ) as second,
8> DATEPART ( millisecond , getdate() ) as millisecond
  相关解决方案