How to delete data from table each two days?

  • Dear All,

    I wanna delete data from table each two days or each week.

    How can I do this???

  • Create a stored procedure which deletes the data you wish to delete.

    Next create a job which executes the stored procedure. You can schedule the job to run once a week, or on any day in the week you wish.

  • Ok I've created the stored procedure, but I could not create a job that calls the stored procedure every week.

    How can I call the stored procedure through the job??

  • Create a new job in SQL Server Agent.

    To tell the job to execute your stored procedure:

    Add a new step. Give it a name like 'Step 1: delete data from myTable'. Select the right database. In command box type: EXEC the_name_of_your_stored_procedure

    To schedule the job:

    In the 'schedules' part you can tell when you want the job to be executed. Click 'New'. Give it a name. I think you'll understand what to do next...

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply