To prepare a backup script that can easily be “replayed”, start SQL Server Enterprise manager.
Expand your databases node under your SQL Server computer name, select the database, right mouse click>All Tasks>Generate SQL Script…
From the dialog box, you have the option to script a single object or multiple objects.You can run the following steps for stored procedures, then again for Views.
Click Show All, then ‘All views’ and ‘All stored procedures’. There are a couple of other options I recommend, one to allow scripting any custom permissions that have been set on any object and to drop any object to allow re-creation. Both steps will save you time, should you ever need this script. Click the Scripting tab, options should default to the following settings:
Now, check the Options tab:
Choose ‘Script object-level permissions’, click OK, the wizard will now prompt you for a file name to create the file. Choose a file name that is self-documenting, along with a date that indicates the date run (e.g. XYZ_SMS-2002-05-20.SQL). Archive this to a save location!
To recreate any of your stored procedures or views, start an instance of Query Analyzer, load the script and run the appropriate portion of the script.











