This is first time I am working on scheduling on job on SQL Server 2005. I want to delete all the data in the table more than 6 months old. I need to use a variable in stead of the #6. Do I need to write a Stored Procedure? Please help? Many thanks in advance.
delete FROM dbo.TICKETS WHERE DATEDIFF(MONTH, START_DATE, GETDATE()) > 6
delete FROM dbo.PNR WHERE DATEDIFF(MONTH, START_DATE, GETDATE()) > 6
delete FROM dbo.PNRS_LOGS where DATEDIFF(MONTH, LOG_DATE, GETDATE()) > 6