How to Create Script for the Database Objects in SQL server 2008

Step 1

Select the database and right click on the database as shown below

1.gif

Step 2

Select "Generate Scripts…" from the sub menu of "Tasks" context menu that appears when you clicked on database name

2.gif

Step 3

Select Database for which you want to generate the script. Here I selected TempDB1 and click next.

3.gif

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.

4.gif

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.

5.gif

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.

6.gif

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.

7.gif

Step 8

You can review your selection at the script wizard summary page. After reviewing your selection summary click finish

8.gif

Output

Bingo............! the script is generated…..

9.gif
 

Up Next
    Ebook Download
    View all
    Learn
    View all