Bhuvnesh (12/28/2012)
Glad you got the solution yourself but i would suggest you to use set based or while loop instead of cursorsee Comparing cursor vs. WHILE loop performance in SQL Server 2008
I've found that comparisons between Cursor and While loops is like comparing the "pouring" speed between Molasses and High Fructose Corn Syrup. Depenind on your preferences, one looks better than the other but neither is designed for "pouring". 😉
--Jeff Moden
Change is inevitable... Change for the better is not.