Since you're in 2008, you can't use the more modern Windowing function methods of doing this, so you would need a self join. So maybe something like this?UPDATE cur SET
SWAP = CASE WHEN cur.Increase <> prev.Increase AND cur.Decrease <> prev.Decrease THEN 1 ELSE 0 END
FROM #mytable cur
LEFT OUTER JOIN #mytable prev ON cur.ID = prev.ID + 1;