declare @date datetime='2010-01-01'; while(Year(@date)=2010) begin if(DATEPART(WEEKDAY,@date) in (1,7)) begin print @date end select @date=DateAdd(DAY,1,@date); end
时间: 2024-09-26 09:34:08
declare @date datetime='2010-01-01'; while(Year(@date)=2010) begin if(DATEPART(WEEKDAY,@date) in (1,7)) begin print @date end select @date=DateAdd(DAY,1,@date); end