SQL Server Scripts
   
 
 Generating Database Script for MS SQL Server Database
In order to generate the database script for MS SQL server database, follow the steps shown below:
Step 1:
Open MS SQL Enterprise Manager.
 
Step 2:
Select the database for which the script has to be generated.
Click on the image to see larger version
Step 3:
Select Database Scripting from the Tools menu.
Click on the image to see larger version
 
Step 4: 
In the Generate SQL Scripts dialog box, choose the General Tab. Uncheck the ‘Script All Objects option’. Select ‘All Tables’.
Click on the image to see larger version
Step 5: 
Choose the options tab in the Generate SQL Scripts dialog. In the Table Scripting Options group, select ‘Script Indexes’ and ‘Script Primary Keys, Foreign Keys, Defaults and Check Constraints’ options. In the File Options group, select  the file format as ‘Windows Text (ANSI)’.
Click on the image to see larger version
Step 6:
Click OK button to generate the script. Save the Script file at a desired directory.