declare @BeginDate DATETIMEdeclare @EndDate DATETIMESET @BeginDate='2011-7-1'SET @EndDate='2011-7-30'
while @BeginDate <= @EndDatebegin PRINT @BeginDate SET @BeginDate=dateadd(day,1,@BeginDate) end