declare @ds datetime,@i int,@de datetime
set @ds='2010-05-01'
set @de=dateadd(day,-1,convert(varchar(7),dateadd(mm,1,@ds),120)+'-01')
set @i=0
while(@ds<=@de)
begin
if datepart(dw,@ds) in(1,7)
set @i=@i+1
set @ds=dateadd(day,1,@ds)
end
select @i
计算周末天数的,替换下@ds变量就行