>>This is nice set-based solution, but I think the same rule applies here as to SQL Server up to 2012 - it is better to use cursor based solution. In this case SCAN BASED solution is very striaghtforward.
>>
>>Try both solutions on a huge set of data.
>
>
>Cursors in SQL Server?
>Everything I read about them is like using GENERAL fields in VFP:
>"Do NOT use them" :-)
Check today's answer in this thread
http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/daba8fd0-62a1-474f-9b9d-fc89f7c43f25
If it's not broken, fix it until it is.
My Blog