Hi,
If it helps - yes you can do away with cursors and still step through everything:-
SET @pk = (SELECT MIN(PK) FROM #Values)
SET @MaxPK = (SELECT MAX(PK) FROM #Values)
WHILE @pk <= @MaxPK
BEGIN
--Do whatever you are doing
SET @pk = (SELECT MIN(PK) FROM #Values WHERE PK > @pk)
END
Though i'm not too certain what good it will do you in this scenario......
Have you checked the execution plan to see where the biggest costs are?
Steve
We need men who can dream of things that never were.