I sometimes have to loop through records in a database and perform a specific action on the value that is returned.
For example, In the script below I loop through the user tables in sysobjects and simply print them out.
This technique is useful when dropping all indices/triggers on a particular table, or adding WITH ENCRYPTION to stored procedures on a live server.
Another use is on development servers where the table structure changes and you want to recompile all stored procedures and refresh all views.