How to run a stored procedure with SQL Server Maintenance Plan

Posted on 2012-08-20
Last Modified: 2012-08-24
I have a store procedure that need to be run every 30 minutes and I need to add this in the Maintenance plan of SQL Server 2008.
How can I do this?

Thank you
Question by:iscivanomar
    LVL 75

    Assisted Solution

    by:Aneesh Retnakaran
    Create a new SQL Server Agent Job, thats the way to do it.

    Author Comment

    I used a Execute a T-SQL Statement Task and added the EXE Stored_Procedure_to_execute.

    Plus, I scheduled this to run every 30 minutes.

    What is the difference between SQL Server Agent Job and Execute T-SQL Statement Task?

    what I did is wrong?

    Thank you
    LVL 9

    Accepted Solution

    The Execute T-SQL Statement task allows you to run virtually any T-SQL code you want from within a Maintenance Plan. In many ways, it is similar to the Execute SQL Server Agent Job task in that it allows you to run custom T-SQL from within a Maintenance Plan. The main difference between these two is that the Execute T-SQL Statement task doesn't require that a separate SQL Server Agent job be created to run the T-SQL, as the T-SQL can be executed directly from this task.

    Author Closing Comment

    Thank you both, I create the task and is working.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Suggested Solutions

    Title # Comments Views Activity
    Copy only dates 3 57
    SQL PIVOT Table 21 29
    indexed table vs unindexed table 19 47
    How to script out data export 36 51
    After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
    If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now