如何对日期进行查询 :
select * from aa where convert(char(4),日期字段,120) ='2005'
select * from aa where convert(char(10),日期字段,120) like '2005%'
select * from aa where year(日期字段) = '2005'
select * from aa where datepart(year,日期字段)=2005
请参考 sql server 联机丛书
本文介绍了在SQL Server中针对日期字段的多种查询方法,包括使用CONVERT、LIKE、YEAR及DATEPART函数来筛选特定年份的数据。
551

被折叠的 条评论
为什么被折叠?



