select * from table where to_char(日期字段,'yyyy-mm')='2000-10' 这个就要求控制输入的日期格式
--或者: declare @年 int,@月 int select @年=1999,@月=11select * from 表 where 日期字段 between dateadd(month,@月-1,dateadd(year,@年-1900,'1900-1-1')) and dateadd(month,@月,dateadd(year,@年-1900,'1900-1-1'))-1
这个就要求控制输入的日期格式
declare @年 int,@月 int
select @年=1999,@月=11select * from 表
where 日期字段 between dateadd(month,@月-1,dateadd(year,@年-1900,'1900-1-1'))
and dateadd(month,@月,dateadd(year,@年-1900,'1900-1-1'))-1