How to: Generate Scripts to Migrate a Database to Windows Azure SQL Database
The Generate Scripts Wizard can be used to create Transact-SQL scripts for SQL Server database and/or related objects within the selected database. You can then use the scripts to transfer schema and/or data to Windows Azure SQL Database.
Before you begin:
Use the Generate Scripts Wizard to:
Migrate a Database
Author: Shaun Tinline-Jones
Before You Begin
Using the Generate Scripts wizard to migrate a SQL Server database to SQL Database should be limited to:
Teams who have experience with the wizard.
Migrating simple databases that need few schema changes to run on SQL Database. The scripts generated from the source database can be modified before being used to create the new version of the database on SQL Database, but using a database project in the SQL Server Data Tools has richer support for making schema changes.
Migrating small databases that do not have much data. The wizard generates scripts that use insert statements instead of bulk copies to transfer the data. The insert statements can be throttled when the tables contain too much data, and are not as fast as bulk copies.
Be careful when choosing options in the wizard. It is easy to select an option that prevents the transfer of important information, such as the option to not generate indexes.
The Generate Scripts Wizard is installed with SQL Server. Use the wizard from SQL Server 2008 R2 or later.
Migrate a Database by Using the Generate Scripts Wizard
Using the wizard involves the following main steps:
Open SQL Server Management Studio and connect to an instance of the Database Engine.
In Object Explorer, right click a database to open a menu, select Tasks…, and then select Generate Scripts.
Choose objects to export.
Set scripting options. You have the options to save the script to file, clipboard, new query window; or publish it to a web service.
Set advanced scripting options.
By default, the script is generated for stand-alone SQL Server instance. To change the configuration, click the Advanced button from the Set Scripting Options dialog, and then set the Script for the database engine type property to SQL Database.
You can also set the Types of data to script to one of the following based on your requirements: Schema only, Data only, Schema and data.
After the script is created, you have the option to modify the script before running the script against a SQL Database to transfer the database.