Step 1
Select the database and right click on the database as shown below
Step 2
Select "Generate Scripts…" from the sub menu of "Tasks" context menu that
appears when you clicked on database name
Step 3
Select Database for which you want to generate the script. Here I selected
TempDB1 and click next.
Step 4
Chose appropriate script options which ultimately depend on your need. Some
options which are toggled from false to true by me are marked with arrow. Click
next when you are done with your options settings.
Step 5
Select the objects of the database for which you want to generate the script
like tables, stored procedures etc. Currently I have only tables in my database
so wizard is showing only "Table" as database object . Select your database
object and click next.
Step 6
Select table for which you want to generate the script you can select all of
them by single click of select all or by individual selection by checking the
checkbox. After selecting your tables click next.
Step 7
Choose your output option. You can generate output in clipboard, in new query
window of SQL server management studio or in a file stored at your specified
location. After selecting appropriate option click next.
Step 8
You can review your selection at the script wizard summary page. After reviewing
your selection summary click finish
Output
Bingo............! the script is generated…..