Just use a cursor for that. Details including example can be found in Books Online.
HOWEVER! Why do you need to do this? There is almost certainly a better way to handle your problem than looping through all rows in a table. Please provide some details as to why you think you need to loop through every row.
The RIGHT answer is NEVER use a cursor. SQL words with entire sets of data at one time, not like mag tapes and record at time processing. You need to study RDBMS for about a year before you post again.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing Analytics and OLAP in SQL Data and Databases: Concepts in Practice Data, Measurements and Standards in SQL SQL for Smarties SQL Programming Style SQL Puzzles and Answers Thinking in Sets Trees and Hierarchies in SQL
Thank you for all the help. I am trying to get it done without looping. The other thread listed above is related to this one so i will ask questions there.