結果 : replace cursor with cte in sql server