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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Hard query Please HELP

Author  Topic 

iancuct
Yak Posting Veteran

73 Posts

Posted - 2002-09-20 : 18:37:38
i wanted to do this without the while loop in access can
anyone help me please

DECLARE @i INT
DECLARE @startDate datetime

SET @startdate = '1/1/2002'
SET @i = 0


TRUNCATE TABLE DAYS

WHILE @i < 365

begin

insert into days([date])
values (@startDate+@i)

SET @i = @i + 1
end



Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-09-20 : 19:47:10

insert into days([date])
select @startdate + n
from numbers


of course ...

You'll have to have a tally table called number ...

Jay White
{0}
Go to Top of Page
   

- Advertisement -