블로그 이미지
LifeisSimple

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Notice

2010. 11. 22. 22:30 Brain Trainning/DataBase

declare @jobName nvarchar(255)

 

declare curJobs cursor fast_forward for

                  select name from dbo.sysjobs where owner_sid = suser_sid('old_account', 0) order by name

 

open curJobs

 

fetch next from curJobs

                  into @jobName

 

while @@FETCH_STATUS = 0

begin

                  EXEC msdb.dbo.sp_update_job @job_name=@jobName, @owner_login_name='new_account'

 

                  fetch next from curJobs

                                   into @jobName  

end


close curJobs

deallocate curJobs



posted by LifeisSimple