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)
 For Loop

Author  Topic 

label
Posting Yak Master

197 Posts

Posted - 2003-08-04 : 16:36:51
Is a "for x=1 to total / next x" type of loop available in Stored Procs?

I've looked in the books online and there's mention of a For clause but it doesn't look to be exactly what I need.

X002548
Not Just a Number

15586 Posts

Posted - 2003-08-04 : 16:42:37




SET NOCOUNT ON

DECLARE @x int, @Total int

SELECT @x = 1, @Total = 10

WHILE @x <= @Total
BEGIN
SELECT @x
SELECT @x = @x + 1
END



Brett

8-)

SELECT POST=NewId()
Go to Top of Page

label
Posting Yak Master

197 Posts

Posted - 2003-08-05 : 09:12:22
quote:
Originally posted by X002548





SET NOCOUNT ON

DECLARE @x int, @Total int

SELECT @x = 1, @Total = 10

WHILE @x <= @Total
BEGIN
SELECT @x
SELECT @x = @x + 1
END



Brett

8-)

SELECT POST=NewId()




Thanks Brett....looks like that'll do perfectly.
Go to Top of Page
   

- Advertisement -