Wednesday, 1 May 2013

Scripting SQL Server Database


SQL Server also gives option to script whole DB. This option can be very useful for situations where we have to transfer selected Tables or Stored Procedures. We have three options
1.       Schema Only
2.       Data Only
3.       Schema & Data.

Step 1: Right click on database go to tasks and select “Generate Script”.



Step 2: This will present a wizard shown below. 



Step 3: This screen presents you with two options
  • Script entire Database and All database Objects
  • Script specific database objects 




Step 4: Set Scripting Options 

Select following option 
      • Output Type: Save script to specific location 
        • Save to file 
      • Files to generate: Single file 
        • File Name: 
        • File Path
        • Overwrite Existing File 
      • Save As 
        • Unicode Test
        • ANSI Text 




Step 5: If you click on advance button, you will get option to script
  • Schema Only
  •  Data Only
  •  Script and Data.
As shown in screen below. 


Step 6: Select "Next" and the wizard will now start creating scripts for selected objects.

 

No comments:

Post a Comment