日期:2014-05-19  浏览次数:20469 次

一个查询时间范围的简单问题
2005-9-8   0:00:00
2001-9-8   0:00:00
2005-7-31   0:00:00
2006-9-8   0:00:00
2004-9-5   0:00:00
2002-4-3   0:00:00
2006-9-5   0:00:00
2002-9-2   0:00:00
2006-7-31   0:00:00
2005-9-8   0:00:00

我现在仅要2005年的数据怎么写?

------解决方案--------------------
1
select * from 表
where datepart(yy,列名)= '2005 '
2
select * from 表
where convert(varchar(4),列名,120)= '2005 '