alter proc [work] as declare @i int set @i=1 while @i<1000 begin select top 1 id into #restdate from dt_work where work_date in (select rest_time from dt_rest ) order by id asc update dt_work set work_date=CONVERT(varchar(100),dateadd("d",1,CONVERT(varchar(100), work_date, 23)), 23) where id>=( select id from #restdate ) set @i=@i+1 drop table #restdate end