SQL 写循环数据

declare @BeginDate DATETIME
declare @EndDate DATETIME
SET @BeginDate='2011-7-1'
SET @EndDate='2011-7-30'

while @BeginDate <= @EndDate
begin
  PRINT @BeginDate
  SET @BeginDate=dateadd(day,1,@BeginDate)
 
end

你可能感兴趣的:(sql)