I have 3 cursors: DECLARE cursor1 CURSOR FOR SELECT @intVar1 = Col1 FROM Table1;
Basically I want to retrieve each Col1 into @intVar1 [using cursor1], then use that to pluck out corresponding rows using cursor2 and cursor3. Is this possible in SQLServer 2005?
asked Mar 07, 2010 at 03:16 PM in Default
I know you've solved your answer, but two things -
1) I hope your solution involved ditching the cursors and using set based code
2) Seeing as my hopes are likely to be dashed, please can you post your solution here such that someone who finds this page from google in the future finds some useful information...
answered Mar 07, 2010 at 07:48 PM
Matt Whitfield ♦♦
I too hope that the cursors were ditched. If the solution were to be posted, then it is highly likely that somebody here can offer an alternative solution to meet your requirements.
answered Mar 07, 2010 at 11:01 PM
I am not a fan of cursors and that is why I post this answer to give you something to consider. Cursors are usually very slow in SQL server, BUT sometimes a cursor outperforms a bad set based statement.
answered Mar 09, 2010 at 06:12 AM