I wrote the following code and ran it on the server. It solved my problem. DECLARE @I INT, @DateString VarChar(255), @D DateTimeWHILE GetDate() < '2004-09-30 00:00:00'BEGIN SET @D = DateAdd(minute, 1, GetDate()) WHILE Convert(VarChar(10), GetDate(), 8) < Convert(VarChar(10), @D, 8) SET @I = 0 IF Month(GetDate()) = 9 AND Year(GetDate()) = 2004 BEGIN Set @DateString = 'DATE '+Convert(VarChar(10), DateAdd(Day, 3, DateAdd(Month, -3, GetDate())) , 1) exec @I=master.dbo.xp_cmdshell @DateString ENDEND
Note that my need was to change the server time to an older time, i.e. if today is Sep 16, I need it to be Jun 19. Tomorrow, I need to be June 20. and so on...If you have any modification, post it hear?Canada DBA