Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Mc2102
Starting Member
4 Posts |
Posted - 2008-11-13 : 11:16:59
|
Hello,I created several maintenance plans and when I execute them through the GUI then they work just fine. They are actually maintenance plans which perform backups. Anyways now I would like to add the execution of the maintenance plans to a SQL script but I am not able to find anywhere what SQL statement or stored procedure I need to use to do that. Is that even possible?Thanks Marcus |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-11-13 : 11:28:32
|
You can find all SQL Script in Report to option in Textfile format . Also there are jobs created to do that.You just need to schedule it in proper time. |
 |
|
Mc2102
Starting Member
4 Posts |
Posted - 2008-11-13 : 11:33:29
|
Sodeep,Thanks for your answer but what I am looking for is not to schedule the maintenance plan. I want to execute it manually through T-SQL. I know you can copy the T-SQL script the maintenance plan executes but I wonder if you can execute the maintenance plan itsself through some SQL. |
 |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-11-13 : 11:45:18
|
Are you looking for SQLmaint?http://msdn.microsoft.com/en-us/library/ms162827(SQL.90).aspx |
 |
|
Mc2102
Starting Member
4 Posts |
Posted - 2008-11-13 : 14:00:27
|
Sodeep,Hmm I am not sure if that is what I am looking for either. Let me try again to explain.I created a maintenance plan called "Backup_DB1". If I execute it in the GUI is runs fine.I now have a T-SQL script which does a bunch of changes to the database and on the very top of this SQL script I want to add a line which would execute the Maintenance Plan and run the backup.Makes sense? |
 |
|
|
|
|