June 30, 2016

SQL tip #6: Scripting multiple SQL objects

By

Theta

SQL tip #6: Scripting multiple SQL objects

Sometimes we need to script multiple SQL objects, either for deployment, documentation or quick search, eg to find SSIS package name.

In the SQL Server Management Studio (SSMS), to script a single object we can use the context menu: with right click on the object open context menu and click action “script <sql object> as”. However, to script all or few SQL objects, this approach can be very laborious.

To script multiple SQL objects, we can use the wizard from “Object Explorer Details” pane. To access the pane, on the View menu, click Object Explorer Details or press F7.

For example, to script multiple SQL jobs, click on Jobs, open “Object Explorer Details”, select jobs for scripting, and from context menu select action to create script to a query window, file, etc.

In a single query you can easily find parameter name, value or other required string like the SSIS package name. The same approach can be used to script tables, functions, triggers or other SQL objects.

For more information on Object Explorer Details pane...