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.
| Author |
Topic |
|
ALBean
Starting Member
12 Posts |
Posted - 2004-05-28 : 12:02:19
|
| Right now I’m using a cursor to do something. But I have been reading the postings on this website and I am wondering if there is a way to do my calculation with set based operations.I would like to go threw an order set of rows and take a value from the row immediately above the current row, do a calculation on that value and then update the value in the current row with the result. (The very first row will be initialized). For example:Initial set:A 1B 0C 0D 0Final Set (calculation: currentRow = rowAbove*2 )A 1B 2C 4D 8(After I get the value in row A, I use a cursor and loop threw rows B to D) Can this be done with an SQL set statement? |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
|
|
ALBean
Starting Member
12 Posts |
Posted - 2004-05-28 : 12:48:05
|
| Thanks Jay,I guess I will stick with my cursor implementation since it appears to be faster in this case. |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-05-28 : 13:31:55
|
| No, I think the point of the article is that the performance is very dependent on your particular data set. I'd recommend doing some tests agains each of the methods.Jay White{0} |
 |
|
|
|
|
|