Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 'Date' Question???

Author  Topic 

winsys
Starting Member

3 Posts

Posted - 2008-02-22 : 10:09:04
I have 2 delete statements listed below:

delete from dbo.samplednumericdata where timesampled <'2007-12-01'

delete from dbo.event where timegenerated <'2007-12-01'

I would like to be able to schedule these statements to run and delete any data over 2 months old. How can I accomplish this instead of manually entering a date like I do now?

Thanks!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-02-22 : 10:10:02
timesampled < dateadd(month, -2, getdate())


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

winsys
Starting Member

3 Posts

Posted - 2008-02-22 : 10:35:26
works great KH, thx.
you rock!
Go to Top of Page
   

- Advertisement -