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)
 Iterating through a Table (result set) without cursors

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-10-23 : 07:40:12
Shadow of the Beast writes "I Have Got a table which i need to iterate through "row by row"

fetching each row and performing a calculation with the value and valueDates and the inserting this calculation into another table


Below is the Quaterly table i want to iterate through without CURSOR or Whil loop


Values Values Dates
1.10 2006-03-31 00:00:00.000
1.20 2006-06-30 00:00:00.000
1.30 2006-09-30 00:00:00.000
1.40 2006-12-31 00:00:00.000







(effectively each row represents a quaterly Value and ValueDate e.g value = 1.50 valuedate is 31/03/2006 the calculations break this down to the monthly data and dates for that quarter)

this expanded data is then fed into another table.

Is there a better way to iterate through the records without using cursors?

Thanks"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-10-23 : 07:49:12
What type of calculation?

Soemthing like

Insert into TargetTable(column)
Select DateAdd(Minute,Values,ValuesDate) from SourceTable

Madhivanan

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

- Advertisement -