The Google gods seem to like a very old page of mine about using Cursors in T-SQL. So, from time to time I get commnets via email. Thought I would share an alternative to using cursors.
[UPDATE] – SQLServerCentral.com has a great article( from 2002) on the use of Temp Tables. You may find the information useful.
I have gotten a ton of hits some links that I created years ago on T-SQL Cursors. Sometimes they are the the best course of action , but may times they are not the most efficient. This posting has some a possible alternative.
Creating Tables with Identity Columns
I like to create tables and temp tables with identity columns. You can then do row by row process the data using the id column. In another post, I will show you how to create and some uses for Table-Valued functions to provide similar utility found with using cursors. Oh, don’t forget our friend the Case Statement, either.