How to Migrate Schema to SQL Azure Using the Generate SQL Server Scripts Wizard
There are many methods you can use to migrate data from an on-premise SQL Server database to SQL Azure. Many of the methods only support migrating data, not schemas. To migrate schemas, you can use the SQL Server Management Studio 2008 R2 Generate SQL Server Scripts Wizard.
To generate the schema
- Open SQL Server Management Studio 2008 R2 (SSMS).
- Connect to your SQL Server that contains the source database that you want to transfer.
- In Object Explorer, expand Databases.
- Right-click the database that you want to transfer, point to Tasks, and then click Generate Scripts.
- From Introduction, click Next.
- From Choose Objects, select the database objects that you want to migrate to SQL Azure, and then click Next.
- From Set Scripting Options, select Save to new query window, and then click Advanced.
- From Advanced Scripting Options, scroll down until you find Script for the database engine type, select SQl Azure Database, and then click OK.
- From Set Scripting Options, click Next.
- From Summary, click Next.
- Click Finish. The query appears in the query window. Don't close the window. You will continue in the next procedure
To migrate the schema
- Right-click in the query window, point to Connection, and then click Change Connection.
- From Connect to Database Engine, enter Server name, and your credential, and then click Options.
- In Connect to database, type the database name where you want to transfer the schema to, and then click Connect.
- From SQL Editor menu, click Execute. Monitor the Messages pane, and make sure all the commands complete successfully.
See Also
- [[Overview of Options for Migrating Data and Schema to SQL Azure]]
- [[How to use Data-Tier Application Import and Export with SQL Azure]]
- [[SQL Azure Data Migration Using SQL Server Import and Export Wizard]]