Comparing cursor vs. WHILE loop performance
  Cursors  Cursors  are a looping construct built inside the database engine and come with a  wide variety of features. Cursors allow you to fetch a set of data,  loop through each record, and modify the values as necessary; then, you  can easily assign these values to variables and perform processing on  these values. Depending on the type of cursor you request, you can even  fetch records that you’ve previously fetched. Because  a cursor is an actual object inside the database engine, there is a  little overhead involved in creating the cursor and destroying it. Also,  a majority of cursor operations occur in tempdb, so a heavily used  tempdb will be even more overloaded with the use of cursors. The types of cursors used are very  important in terms of performance. Below is a list of the available cursor types as listed on       FORWARD_ONLY     Specifies  that the cursor can only be scrolled from the first to the last row.  FETCH NEXT is the only supported fetch option...