You can tweak this to your needs. Just subtracting days from GetDate() works in SQL Server just like it works in Access Date()-30 sort of thing.
SELECT DateCreated FROM EDI_BATCHES WHERE DateCreated < (GetDate()-30) ORDER BY DateCreated DESC --- Mike Belcher <[EMAIL PROTECTED]> wrote: > I forgot to mention that the string is from an > access project and works > there but the date part doesn't seem to work with > SQL server. I am using SQL > server on this current project and need to figure > out how to delete messages > older than 30 days....... Thank you....... > > -----Original Message----- > From: Mike Belcher > [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, June 08, 2005 6:46 PM > To: '[email protected]' > Subject: DateAdd(""d"",-30,Date()) And Date() > > strSQLstringDelete = "DELETE FROM Winks > WHERE [t_username] = '" & > strWinkOwner & "' AND [WinkDate] Between > DateAdd(""d"",-30,Date()) And > Date()" > > > > Hi guys and gals. Above is a string to delete > records between the date NOW > and 30 days before but what I am trying to do is > delete any record that is > older than 30 DAYS. I am not great at the date stuff > in SQL strings can > anyone tell me how I would modify the end of this > string? Thank you. > > Mike > > > > > > Yahoo! Groups Links > > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ > > > [EMAIL PROTECTED] > > > > > Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
