views:

952

answers:

2

Currently, if I want to output a SQL script for a table in my database, in Management Studio, I can right click and output a create script.

Is there an equivalent to output an SQL script for a database's maintenance plan?#

Edit

The company I work for has 4 servers, 3 servers and no sign of integration, each one running about 500,000 transactions a day. The original maintenance plans were undocumented and trying to create a default template maintenance plan.

+2  A: 

You can't export them as scripts, but if your intention is to migrate them between server instances then you can import and export them as follows:

Connect to Integration Services and expand Stored Packages>MSDB>Maintenance Plans. You can then right click on the plan and select import or export

Martin
A: 

I don't think you can do that with Maintenance Plans, because those are DTS packages, well now they are called SSIS (SQL Server Integration Services).

There was a stored procedure from which you could add maintenance plans, but I think that it may be deprecated. (sp_add_maintenance_plan). I don't have a SQL 2005 to test here.

The question is, why would you want to export the complete mp? :) If it's for importing in other server, then a ssis package could be useful. I suggest you take a look in that direction, because those you can export/import among servers.

Martín Marconcini