How to script out the database objects
You might have got requirements to script out the database object and give it to developers. Often developers need codes from current production environment. Here is how to generate scripts from database for all or selected database objects:
Right click the database and select Tasks and under that select Generate Scripts...
Right click the database and select Tasks and under that select Generate Scripts...
Select next if the welcome screen appears and then in the next scree select the database for which you want to generate the scripts and press Next. In the Choose Script Option widow select how you wish to script. Do you wish to include a drop statement before or include IF NOT EXISTS. Select your options and press Next.
In Choose Object Type window select the object types you want to script out and press Next. For the example I have selected Stored procedures below.
In the next few (Based on numbers of object types you have selected) windows select the objects you want to script out. Below is the screen shot and I have hide the names of the objects.
Press Next once you have selected the objects. Then in the next widow for output options select appropriate option you like and press Finish. I have selected to script all selected objects to single file in C drive . It create the script in my local C drive.
Now you have scripted all the selected objects.
Comments