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
 General SQL Server Forums
 New to SQL Server Programming
 Date + 30

Author  Topic 

evanburen
Posting Yak Master

167 Posts

Posted - 2011-06-07 : 14:02:44
This seemed like it would be so easy but I'm struggling with this. I have a field named document_date and I need to identify those records where the document_date is over 30 days old. This is my lame attempt

WHERE
document_date > dateadd( day, 30, document_date() )
aND Status IS NULL

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-06-07 : 14:18:32
WHERE document_date < dateadd( day, -30, getdate() )
AND Status IS NULL
Go to Top of Page
   

- Advertisement -