Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dirwin26
Yak Posting Veteran
81 Posts |
Posted - 2005-09-20 : 10:38:30
|
| I need to insert dates to cover the range from tomorrow to 365 days from tomorrow. ideally with no business days. I've been messing around with the below, which of course adds only tomorrow's date....but I am having problems taking it further. Can anyone answer this?INSERT INTO #res (TheDate)VALUES (GETDATE() + 1) |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-20 : 10:44:05
|
See if this helps youDeclare @t table(d datetime)Declare @i intset @i=1while @i<=365 Begin insert into @t values(Getdate()+@i) set @i=@i+1 endselect * from @t MadhivananFailing to plan is Planning to fail |
 |
|
|
dirwin26
Yak Posting Veteran
81 Posts |
Posted - 2005-09-20 : 10:54:55
|
| It worked like a charm! Thanks |
 |
|
|
|
|
|