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
 Site Related Forums
 Site Related Discussions
 delete problem with date

Author  Topic 

sanjnep
Posting Yak Master

191 Posts

Posted - 2006-05-31 : 12:17:34
I have following data:
Date
-----------------------
2006-05-31 11:48:36.547
2006-05-30 11:48:42.623
2006-05-29 11:48:48.123
2006-05-28 11:48:53.610
2006-05-27 11:48:59.123
2006-05-26 11:49:05.450
2006-05-25 11:49:11.250
2006-05-24 11:49:17.077
2006-04-01 11:50:09.090
2006-03-31 11:50:14.090
2006-03-30 11:50:20.140
------------------------------
I need to delete all the date which is greater than 5 days.I mean I need to delete following from the table.
2006-05-26 11:49:05.450
2006-05-25 11:49:11.250
2006-05-24 11:49:17.077
2006-04-01 11:50:09.090
2006-03-31 11:50:14.090
2006-03-30 11:50:20.140

How to write sql plz help me.
Thanks
Sanjeev OH

sanjnep
Posting Yak Master

191 Posts

Posted - 2006-05-31 : 12:54:38
seems no one can help me :(
ok bye


Sanjeev Shrestha
12/17/1963
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-05-31 : 14:14:27
quote:
Originally posted by sanjnep

seems no one can help me :(
ok bye


Sanjeev Shrestha
12/17/1963



Patience is a virtue.

If you have a SQL question, try posting it on one of the SQL Server Forums. I would suggest the New to SQL Server forum.

This forum is for questions about this web site, so that is most likely why you didn't get an answer.





CODO ERGO SUM
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-05-31 : 20:57:13
Please post in appropriate forum.

delete d
from yourtable d
where yourdatecol < dateadd(day, datediff(day, 0, getdate()) - 5, 0)



KH

Go to Top of Page
   

- Advertisement -