Generate copy of your database
Sometimes you may want to create the copy of your database structure. In order to create tables, functions stored procedures one by one in SQL Server you can generate a script that can create the same database structure for you. This is done very easy with SQL Server Management Studio.
So first you’re going to chose a database and right click on it. Go Tasks->Generate Scripts. See the picture below.
In the following window you will have two options to choose. The first option is to script entire database and all database objects. Second is to select a specific database objects. In this tutorial I will choose the first option and script entire database and all database objects and click next. See picture below.
In the scripting options window you can either save script on specific location or publish to a web service. You also choose where you want to save or generate the script. Here you have 3 options. Save to file, save to clipboard and save to new query window. After you’re done click next button to go to the next step.
In the next window you see the summery of what you have chose to script. You see the source, target and options of your scripts. On source you see the server, database and selected objects. On target you see destination and in the options you see output type and where the script is going to be generated. See picture below.
In the last window you are saving or publishing the script. Click finish to finalize the procedure.