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.
| Author |
Topic |
|
Velnias
Yak Posting Veteran
58 Posts |
Posted - 2009-03-11 : 06:15:51
|
| Hi I am looking for a query to check if the "dateAdded" field is older than 6 months and if so then delete these records. |
|
|
shaggy
Posting Yak Master
248 Posts |
Posted - 2009-03-11 : 06:22:25
|
| select dateadd(mm,-6, getdate()) |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-11 : 06:23:58
|
Six months to the millisecond or 6 months to the day accuracy? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
Velnias
Yak Posting Veteran
58 Posts |
Posted - 2009-03-11 : 06:24:25
|
| that will just select them ?I was looking for delete query which compared my dateAdded column and check if it was older than 6 months |
 |
|
|
Velnias
Yak Posting Veteran
58 Posts |
Posted - 2009-03-11 : 06:24:58
|
| I would say to day |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-11 : 06:24:58
|
DELETEFROM Table1WHERE dateAdded < DATEADD(MONTH, -6, GETDATE()) E 12°55'05.63"N 56°04'39.26" |
 |
|
|
Velnias
Yak Posting Veteran
58 Posts |
Posted - 2009-03-11 : 06:26:00
|
| Thanks Peso |
 |
|
|
|
|
|