例:
Table A ,Column Birthday datetime
则对"Birthday"为"2012-12"的模糊查询方法有:
1.
select * from A where datediff(day,Birthday,'2012-12-01')=0
此处因为要保持"yy-mm-dd"的完整新,模糊查询功能勉强
2.
select * from A where convert(varchar,Birthday,120) like '2012-12%'
注:SELECT CONVERT(varchar(100), GETDATE(), 120)转换后的日期格式为: 2006-05-16 105749
3.
select * from A where Birthday between '2012-12-01' and '2012-12-30'
此处实现模糊查询功能勉强
附:SQL中使用CONVERT转换时间输出格式
http://download.csdn.net/detail/hugaozhuang/4750557