declare @int_month int,@max_day int,@strDate varchar(10)set @int_month=7 --输入月份if @int_month between 1 and 12beginselect @strDate=cast(year(getdate()) as varchar(10))+'-'+cast(@int_month+1 as varchar(10))+'-'+cast('1' as varchar)select @max_day=day(dateadd(day,-1,convert(varchar(10),@strDate,120)))declare @t table(sdate smalldatetime)declare @i intset @i=1while(@i<=@max_day)begininsert into @t select cast(year(getdate()) as varchar(10))+'-'+cast(@int_month as varchar(10))+'-'+cast(@i as varchar)set @i=@i+1endselect count(1) from @t where datepart(dw,sdate)-1 not in (0,6)endelse print '月份错误'