查询说时间段内所有周六日 DECLARE @t TABLE(date0 DATETIME) DECLARE @st DATETIME,@et DATETIME SET @st=‘2007-01-01‘ SET @et=‘2008-01-01‘ WHILE @st <@et BEGIN INSERT INTO @t VALUES(@st) SELECT @st=DATEADD(DAY,1,@st) END SELECT date0,DATENAME(weekday,date0) FROM @t WHERE DATEPART(weekday,date0[email protected]@DATEFIRST-1) IN (6,7)
时间: 2024-10-20 09:36:16