字符串 转日期
select * from catering
where time between convert(datetime,'2012-12-1 00:00:00',120) and convert(datetime,'2012-12-31 23:59:00',120)
结果是查询到了 但是查询的数据不全
消息提示:
消息 241,级别 16,状态 1,第 1 行
从字符串转换日期和/或时间时,转换失败。
[解决办法]
select * from catering
where convert(datetime,time) between '2012-12-1 00:00:00' and '2012-12-31 23:59:00'
[解决办法]
select * from catering
where [time] >= '2012-12-01' and [time]<'2013-01-01'