The Stored Procedure has a date parameter.myProc should run in a loop while the date is between '2010-01-05' and '2010-01-25',so date '2010-01-28' will be skipped.I dont want to add anything inside the stored procedure proc_student,would prefer if just running it from a query outside the stored procedure proc_student.

This example works ok, but I am looking for other methods to do the same.Please view code below and provide any suggestions, thanks.*/

insert into Students values(1, 'Goran',10,'2010-01-05');insert into Students values(2, 'Nikolai',10,'2010-01-07');insert into Students values(3, 'Oksana',10,'2010-01-10');insert into Students values(4, 'Peter',10,'2010-01-17');insert into Students values(5, 'Steven',10,'2010-01-28');

My recommendation would be to rewrite the proc_student stored proc to use set based code instead of RBAR. However, I do understand that that is sometimes just not possible. With that in mind, let's not even think of using a cursor or While Loop. Instead, let's use some of the features of SQL Server 2005 to keep the code short, fast, and sweet. BTW... thanks for posting your data the way you did... made it real easy to figure this out...