Using MS-SQLServer 7, I am trying to use nested cursors to loop through
records based on sequentially chosen criteria from the outer recordset.
So,
user_id region_id median_volume
------- ------- -----------
1 a <NULL>
2 a <NULL>
3 a <NULL>
etc. is the outer cursor. Then each combination of user_id and region_id is
used to pull records from another table, which I also must loop through (I
am interested in finding the median volume in another table). The reason I
must use nested cursors in this scenario is that I am not aware of any
median function in SQLServer 7, so my plan was to pull all the records,
sorted in order of volume, and pick the one in the middle (which would be
the median, right?).
the rowcount resulting from the last operation, which (I checked) doesn't
work in my code, unless opening the nested cursor does not count as an
time)?
Can someone explain the rules to me of this system variable? I have books
but I can't find an answer to this question.
I hope this is clear to someone because it's driving me crazy. And if
there's a better way to approach it, I'd like to hear that too.
Thank you all for your help.