結果 : how to use while loop instead of cursor in sql server