首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

SQL 数据库,该怎么处理

2012-03-31 
SQL 数据库数据库中查询时间精确到秒 方法是什么?[解决办法]SQL code1 select2DATEPART ( year , getdat

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

热点排行