• Glad you got the solution yourself but i would suggest you to use set based or while loop instead of cursor

    see Comparing cursor vs. WHILE loop performance in SQL Server 2008

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)