Today I will show you how to Generate Full Data Base Script in SQL Server 2008 or 2005.
By Generating SQL Data Base script basically we copy complete database schema and all of its objects such as Stored Procedures, Functions, Triggers, Tables, Views, Constraints etc. You can review your schema, backup for reference or use it to compare with previous backup.
SQL Server Management Studio provides an efficient wizard to generate scripts to transfer objects along with their dependencies as well as the data.
In this tutorial, let's firstly generate a migration script for the following objects from the AdventureWorks database:
Script objects Includes Tables,Store Procedures,Views and User Defined Functions.
One of our requirements is to move the objects along with their related keys, constraints, relations, triggers, user defined data types, etc. To generate a script for the migration process let's right click on the your Required database, select the 'Tasks' and 'Generate Scripts' options as shown below:
The second screen of wizard is the 'Select Database' screen. On this screen we need to select the appropriate database.We are also not going to select the 'Script all objects in the selected database' option since we only want to migrate a subset of the objects. Next click the 'Next' button to continue the wizard.
In this 'Choose Script Options' screen and Press Next Button.( NOTE:-Select these options very carefully because all these options will be reflected in the generated script for the migration process.)
Here Checked Required Object and , click the 'Next' button.
Select your Required Store Procedures and Then Next.
Select your Required Tables and Then Next.
Select your Required Views and Then Next.
Select your Required User Define Functions and Then Next.
In the 'Output Option' screen is intended to determine the final output for the wizard. The options include generating a file in a specified path, copying the contents to the clipboard or saving the results to a SSMS query window. In our example, I have choose to script in a new query window.
Next will be the 'Script Wizard Summary' screen which summarizes all of the options selected in the wizard. Click the 'Finish' button to begin the script generation.
Once you press the 'Finish' button the 'Generate Script Progress' screen will outline the status of each step.
Below is a sample screen shot of the script generated . You can also review the generate script here.
By Generating SQL Data Base script basically we copy complete database schema and all of its objects such as Stored Procedures, Functions, Triggers, Tables, Views, Constraints etc. You can review your schema, backup for reference or use it to compare with previous backup.
SQL Server Management Studio provides an efficient wizard to generate scripts to transfer objects along with their dependencies as well as the data.
In this tutorial, let's firstly generate a migration script for the following objects from the AdventureWorks database:
Script objects Includes Tables,Store Procedures,Views and User Defined Functions.
One of our requirements is to move the objects along with their related keys, constraints, relations, triggers, user defined data types, etc. To generate a script for the migration process let's right click on the your Required database, select the 'Tasks' and 'Generate Scripts' options as shown below:
The wizard is the welcome screen as shown below. Click the Next button to continue the process.
The second screen of wizard is the 'Select Database' screen. On this screen we need to select the appropriate database.We are also not going to select the 'Script all objects in the selected database' option since we only want to migrate a subset of the objects. Next click the 'Next' button to continue the wizard.
In this 'Choose Script Options' screen and Press Next Button.( NOTE:-Select these options very carefully because all these options will be reflected in the generated script for the migration process.)
Here Checked Required Object and , click the 'Next' button.
Select your Required Store Procedures and Then Next.
Select your Required Tables and Then Next.
Select your Required Views and Then Next.
Select your Required User Define Functions and Then Next.
In the 'Output Option' screen is intended to determine the final output for the wizard. The options include generating a file in a specified path, copying the contents to the clipboard or saving the results to a SSMS query window. In our example, I have choose to script in a new query window.
Next will be the 'Script Wizard Summary' screen which summarizes all of the options selected in the wizard. Click the 'Finish' button to begin the script generation.
Once you press the 'Finish' button the 'Generate Script Progress' screen will outline the status of each step.
Below is a sample screen shot of the script generated . You can also review the generate script here.
0 comments:
Post a Comment