|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, January 04, 2011 1:28 PM
Points: 30,
Visits: 66
|
|
Hi all.
I have the following code:
DECLARE prod_cursor CURSOR FOR SELECT productid <--Problem child FROM @products OPEN prod_cursor DECLARE @prodid_
FETCH NEXT FROM prod_cursor INTO @prodid_ WHILE (@@FETCH_STATUS <> -1) BEGIN IF(@@FETCH_STATUS <> -2) BEGIN (line by line processing) END FETCH NEXT FROM prod_cursor INTO @prodid_ END CLOSE prod_cursor DEALLOCATE prod_cursor
SELECT * from @prodid_
Problem is that I am getting the cursor select's result first then the last select's result set. I only want the last result set. Is there a way i can supress the cursor result set?
many thanks
birdie3321
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Monday, May 06, 2013 1:26 PM
Points: 2,359,
Visits: 3,292
|
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, January 04, 2011 1:28 PM
Points: 30,
Visits: 66
|
|
| Thanks peso... I am looking for different solutions...unfortunately i am not a T-SQL wiz and was hoping for something a little more straight forward; e.g., is there an obscure option on the FETCH statement that i could use?
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Monday, May 06, 2013 1:26 PM
Points: 2,359,
Visits: 3,292
|
|
As told in other thread, you don't need doubled nested cursors. All it takes is one update statement and one insert statement.
N 56°04'39.16" E 12°55'05.25"
|
|
|
|