IT
摘要: 字号:大 中 小 SQL Server中文版的默认的日期字段datetime格式是yyyy-mm-dd Thh:mm:ss.mmm 例如:select getdate()2004-09-12 11:06:08.177这对于在要不同数据库间转移数据或者习惯oracle日期格式YYYY-MM-DD HH24:MI:SS的人多少有些不方便.我整理了一下SQL Server里面可能经常会用到的日期格式转换方法:举例如下:select CONVERT(varchar, getdate(), 120 )2004-09-12 11:06:08select replace(replace(replace(CO 阅读全文
posted @ 2010-12-08 13:39 liufei 阅读(199) 评论(0) 推荐(0)
摘要: select * from ShopOrder where datediff(week,ordTime,getdate()-1)=0 //查询当天日期在一周年的数据select * from ShopOrder where datediff(day,ordTime,getdate()-1)=0 //查询当天的所有数据--查询当天: select * from info where DateDiff(dd,datetime,getdate())=0 --查询24小时内的: select * from info where DateDiff(hh,datetime,getDate())=24 - 阅读全文
posted @ 2010-12-08 11:56 liufei 阅读(4306) 评论(0) 推荐(0)