-
Date Problem in SQL Server
Hi,
I'm very new to SQL Server. I have an issue.
I should create a job which is running on month end that deletes all the records upto 2 months before. For eg. if the job is running at May 31st, all records upto March 31st should delete. How should I do that. Please send me the code for the same.
Thanks
Rajaraman S.
-
if your database name is AAA if your table name is BBB and has a date column CCC then the code will look like
use AAA
go
delete from BBB where CCC <=dateadd(m,-2,getdate())
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|