[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


How to run a stored procedure with SQL Server Maintenance Plan

Posted on 2012-08-20
Medium Priority
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
  • 2
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 1000 total points
ID: 38313668
Create a new SQL Server Agent Job, thats the way to do it.

Author Comment

ID: 38313789
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

Accepted Solution

selva_kongu earned 1000 total points
ID: 38323921
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

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

872 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