摘要: SQL Server 中时间比较例子:select count(*) from table where DATEDIFF ([second], '2004-09-18 00:00:18', '2004-09-18 00:00:19') > 0 说明 select DATEDIFF(day, time1 , time2) 对应示例语句如下 select DATEDIFF(day, '2010-07-23 0:41:18', '2010-07-23 23:41:18') time1 > time2 为负数; time1 & 阅读全文
posted @ 2012-10-17 15:37 阳.光.的.味.道 阅读(248) 评论(0) 推荐(0) 编辑
摘要: SQL Server 中截取日期的日期部分与时间部分CONVERT ( data_type [ ( length ) ] , expression [ , style ] )SQL Server 中截取日期的日期部分:select convert(varchar(10),getdate(),120)SQL Server 中截取日期的时间部分:select convert(varchar(8),getdate(),108)SQL Server中截取日期的"日期+时间"部分:select CONVERT(varchar(16), getDate(),120)PS:附参数表不带世 阅读全文
posted @ 2012-10-17 15:27 阳.光.的.味.道 阅读(8843) 评论(0) 推荐(0) 编辑