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)
 Can I avoid CURSORS??

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-05 : 08:02:34
David writes "I've been racking my brains for several days over this problem so I hope someone might be able to give me a nudge in the right direction.

I have a simple table as below

ID - START - END

1 -- 34 -- 37

2 -- 76 -- 78

3 -- 12 -- 14

I need to look at ID=1, insert all the values from 34 -> 37 into another table, and then repeat the process for the other records (id=2, id=3 etc), giving the following results:

ID - VALS

1 -- 34

1 -- 35

1 -- 36

1 -- 37

2 -- 76

2 -- 77

2 -- 78

3 -- 12

3 -- 13

3 -- 14

Now, I've got the insert logic working fine, but I'm stuck at how to look at an individual record i.e. id=1, perform an insert based on the value of id, and then move onto the next record. Can I do this without cursors?

Any help greatly appreciated

David "

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2002-04-05 : 08:05:13
Please see http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=14639 for updated information.

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page
   

- Advertisement -