0% found this document useful (0 votes)
39 views

How To Genrate DB Schema

This document describes the steps to generate a database schema script in SQL Server Management Studio: 1. Connect to a SQL Server instance and select the database. Right click and select "Generate Scripts..." 2. Choose to script the entire database or specific objects. By default, all database objects will be scripted. 3. Select options like the save location, whether to include data, and advanced scripting preferences. The script will contain the full schema by default. 4. A summary dialog box displays the selections. Click Finish to generate the scripts in the specified location.

Uploaded by

Vikram sharma
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

How To Genrate DB Schema

This document describes the steps to generate a database schema script in SQL Server Management Studio: 1. Connect to a SQL Server instance and select the database. Right click and select "Generate Scripts..." 2. Choose to script the entire database or specific objects. By default, all database objects will be scripted. 3. Select options like the save location, whether to include data, and advanced scripting preferences. The script will contain the full schema by default. 4. A summary dialog box displays the selections. Click Finish to generate the scripts in the specified location.

Uploaded by

Vikram sharma
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Generate Db schema script

 Open SQL Server Management Studio, connect to SQL Server Instance.


 Next, expand the databases folder then select the database, and right click on database
then point to Tasks and click on Generate Scripts...

 You will see an Introduction Dialog box opens, click on Next Button.


 Once you click on Next button, a choose objects dialog box opens.
 Now you can select either entire database or specific objects in the database as follows:
 Script entire database and all database objects: it will generate a script for all the tables,
views, stored procedure, functions and other objects in that database. By default it is set to
Script entire database and all database objects.
 Specific database objects: it will generate a scripts only for the objects that you have
selected.
 Let’s generates the scripts for entire database, click on Next button as shown below.

 Now you will see, a set scripting options dialog box. You can see various options regarding
where to save the script, you can chose location where you want to save you script, or can
select save to clipboard or save to new query window.
 In Advance option, you can do the required changes for generating a script for the selected
objects.
 That you can select based on your requirement.
 Let’s see the option Types of data to scripts that allows you to choose a type of data to
script that can be either Data only, schema only or Shema and Data, by default it is set
to Schema only. 
 If you want script including both schema and data then select schema and data and click
on OK button.
 After that click on Next button.
 Once you click on Next button, you will see a summary dialog box, here you can review your
selections.
 If you want to make some changes then you can click on previous button otherwise you
can click on Next button.

 After clicking on Next button, you will see a dialog box Save Scripts, which let you know
the current status while scripting is being generated, currently it is in in progress.
 Once it is completed, you will see a summary of all the completed script with status as
shown below.
 If you want to save this report for your reference, you can click on Save Report button also.
 Finally, click on Finish button to close the wizard. 

 Now you see the generated scripts in the specified location that you provided.
 As you can see, the scripts is taken for Prod_Db, therefore when you execute this script a database
will be created with same name Prod_Db, including all the schema and data.

You might also like