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 2005 Forums
 Transact-SQL (2005)
 LOOP

Author  Topic 

WoodHouse
Posting Yak Master

211 Posts

Posted - 2009-07-30 : 10:37:43
Hi Guys

Am new to sql server...pls help on this...


Create table Test - 100 records

While Loop test
Calculations for two rows for 100 rows
End

Remaining 98 records
Next time the loop will take 98

While Loop test
Calculations for two rows for 98 rows
End

Next time the loop will take 96

While Loop test -- 96 records now..
Calculations for two rows for 94 rows
End

Its upto when the table is empty or when the condition is meeting

How to iterate in single loop….

Please help out….

NeilG
Aged Yak Warrior

530 Posts

Posted - 2009-07-30 : 10:45:33
Not sure on what you're trying to achive here can you explain further
Go to Top of Page

WoodHouse
Posting Yak Master

211 Posts

Posted - 2009-07-30 : 10:52:32
[code]
I have table with 100 records

First time I took all 100 records for calculations
After applying formula I will get only 98 records as per the formula rule..

Again I took remaining 98 records and will apply same formula
After I get only 96 records

Again I took 96 records will apply same formula
After I get only 96 records

So this loop will continue upto end of the record

How to form the query…..

[/code]
Go to Top of Page

WoodHouse
Posting Yak Master

211 Posts

Posted - 2009-07-31 : 01:04:27
Hi

Pls help on this...
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-07-31 : 02:34:46
What is the calculation involved in two rows?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

WoodHouse
Posting Yak Master

211 Posts

Posted - 2009-07-31 : 02:38:50
hi


The data are each product sales details for 36 months….

Inventory forecasting formulas
Go to Top of Page
   

- Advertisement -