• Awesome article, especially the part at the end.

    One things that might be worth pointing out is that while there are genuinely good times to use cursors, most of the time you can take things that look like they require a loop and do it in pass. If you are generating dynamic sql for instance it is often possible to use a select statement that generates all the commands at once and then just pass that as a batch to an exec statement instead of looping through.

    Also, it is sometimes it is worth putting some of that logic inside a different language, such as C# or python, that connects to SQL Server instead of doing it all in T-sql scripts.

    ---
    Timothy A Wiseman
    SQL Blog: http://timothyawiseman.wordpress.com/